You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add full type hover popup to VS Code commands #35601
Several issues have been opened for this problem, but they have been closed as a duplicate of an issue which barely mentions the problem, let alone addresses it: microsoft/vscode#64566
The problem is simple. The three dots means you can't copy and paste definitions like you used to be able to. This is an absolutely essential feature because TypeScript isn't even close to being used everywhere, and the intellisense of Javascript files inside TypeScript files is way worse than inside Javascript files. This basically means the easiest way to create a d.ts file is to copy the type definition in the hover inside Javascript and then paste it into a d.ts file so TypeScript files can use it. It also helps me debug overloads and unions when things are going awry.
Even just a command that would popup the hover with the full definition instead of the abbreviated definition would be incredibly useful. Currently the shortcut is Ctrl+k, Ctrl+i for the abbreviated definition, so I take it there is a command behind it that can be typed into the command list (ctrl+shift+p). So even just adding the command for people to manually add a shortcut for would be really useful.
I can work around it, but I spend hours more time per week because of it.
Arlen Beiler (@Arlen22) This is what microsoft/vscode#64566 is about: being able to expand the error to see more detail.Even in JS there are types that are too large to display (or infinite), so it is not possible to just always expand the ... eagerly.
Can you provide sample code that shows when the ... gets in the way
An infinite recursion should simply be marked as infinite (same color as never) indicating that some level of recursion is involved, I suppose, and the user could then end the recursive reference in some way in order to get a complete type output.
Normally the types I work with are not too large to display. If they are I can usually break them apart into smaller chunks in one way or another, either by making minor edits to the Javascript or by handwriting a Record, or stuff like that.
It's just that the ... prevents this from working at all, especially since I don't really know whether all ... are referring to the exact same type or what that type is. And then someone mentioned | ... and 4 more ... | in a string union, which obviously completely breaks copy and paste.
Reacted by Braden Bisping, Bernhard Häussner and Feranmi Akinlade
Reacted by Dan M., Alexey Lyakhov, GirkovArpa, Ben Smith, Braden Bisping, Pierre-François Salmand, Alexandru Berghian, Marius, Feranmi Akinlade, Doctor and 2 more
The name field is obvious and useless and I would just remove the contents or change them to a named reference, but the generic inside options: TouchableFeedbackOptions gives me no information, and I critically need to know what the exact properties are being brought in.
Reacted by Guilherme Ventura, Oleksandr, Yadiel Arroyo, Dan M., Alexey Lyakhov, Alaa Moucharrafie, GirkovArpa, Tony Xiao, Bryan Field, Braden Bisping and 5 more
This is same request I had in the diagnostics issue.
Use case I had is that I often found myself seeing a type in the hover tip, and copying it out. It never worked after the changes.
I actually don't understand why the hover tip needs to be abbreviated with three dots. It has a scrollbar. It's perfect abbreviation itself, you can expand it by scrolling! Even if the three dots were expandable by clicking, it would be worse UI in terms of usability, scrolling is easier way to "expand" the view.
P.S. Recursive types are an outlier, I don't mind having dots for them (since it can be infinite). I think in general VSCode should try to show as much as possible of the type, and user can scroll if they wish to see more of the type.
Reacted by Tim van der Horst, Ruslan Stelmachenko, Bosco Domingo, Marius, Feranmi Akinlade, snarbles2 and Joschka Weniger
And now this evening I am diagnosing type problems and it is not showing me a second type that I know is different than the first one that it is showing me. It’s a union on the values of an object and it is only expanding the first type in the union.
Name: TypeScript Explorer
Id: mxsdev.typescript-explorer
Description: Full type information for variables, components, functions, and more in TypeScript projects!
Version: 0.4.2
Publisher: mxs
"noErrorTruncation": true Did not work correctly for me even though it's been proposed several times as a solution in other questions like this one.
A quick fix that actually does work would be... some kind of a more offensive solution ;p Start by opening /resources/app/extensions/node_modules/typescript/lib/tsserver.js and change ts.defaultMaximumTruncationLength = 160 at around line 13471 (so far) to something higher like ts.defaultMaximumTruncationLength = 800.
This will get you what you are waiting for. A nice 800 chars long max type definition on hover. You can of course custom this value as much as you want.
This might not be politically correct for you will need to do it again after every vs code update, but it works just fine and you'll finally get your full type on hover. Note that you'll need to restart your tsServer. To do so:
in vscode: ctrl + shift + P -> type "restart ts server" -> press enter. wait a couple seconds, it's fairly quick.
I'm useing typescript v5, I found that on tsc.js not tsserver.js.
EDIT: I fixed it patching typescript.js instead (this is for v5.6.2):
diff --git a/lib/typescript.js b/lib/typescript.js
index 90f3266ee69f247b20bd892b1a975220489f094f..87f11795f1f298928cb9d9f26e13de51817a7656 100644
--- a/lib/typescript.js+++ b/lib/typescript.js@@ -16056,7 +16056,7 @@ function isInternalDeclaration(node, sourceFile) {
// src/compiler/utilities.ts
var resolvingEmptyArray = [];
var externalHelpersModuleNameText = "tslib";
-var defaultMaximumTruncationLength = 160;+var defaultMaximumTruncationLength = 1e6;
var noTruncationMaximumTruncationLength = 1e6;
function getDeclarationOfKind(symbol, kind) {
const declarations = symbol.declarations;
Old post:
It used to work in TS 5.4, but now it doesn't (I tried every minor version back to 5.0.4). Even in 5.6, with the following patch, complex types are truncated:
diff --git a/lib/tsc.js b/lib/tsc.js
index 37e7f28602e6337b6216810d6a40e6701a99f0a5..6ac55bc88de4c3415cac5e218b2b4dad0a3adfc1 100644
--- a/lib/tsc.js+++ b/lib/tsc.js@@ -12463,7 +12463,7 @@ function isInternalDeclaration(node, sourceFile) {
// src/compiler/utilities.ts
var resolvingEmptyArray = [];
var externalHelpersModuleNameText = "tslib";
-var defaultMaximumTruncationLength = 160;+var defaultMaximumTruncationLength = 1e5;
var noTruncationMaximumTruncationLength = 1e6;
function getDeclarationOfKind(symbol, kind) {
const declarations = symbol.declarations;
If you have bun as your package manager you can use the bun patch command in order to
ensure that your modifications are re-applied after each bun install
Activity
mjbvz commentedon Dec 6, 2019
Arlen Beiler (@Arlen22) This is what microsoft/vscode#64566 is about: being able to expand the error to see more detail.Even in JS there are types that are too large to display (or infinite), so it is not possible to just always expand the
...eagerly.Can you provide sample code that shows when the
...gets in the wayArlen22 commentedon Dec 7, 2019
An infinite recursion should simply be marked as
infinite(same color asnever) indicating that some level of recursion is involved, I suppose, and the user could then end the recursive reference in some way in order to get a complete type output.Normally the types I work with are not too large to display. If they are I can usually break them apart into smaller chunks in one way or another, either by making minor edits to the Javascript or by handwriting a Record, or stuff like that.
It's just that the
...prevents this from working at all, especially since I don't really know whether all...are referring to the exact same type or what that type is. And then someone mentioned| ... and 4 more ... |in a string union, which obviously completely breaks copy and paste.mjbvz commentedon Dec 7, 2019
Can you provide some specific code examples?
Arlen22 commentedon Dec 9, 2019
Arlen22 commentedon Dec 9, 2019
The name field is obvious and useless and I would just remove the contents or change them to a named reference, but the generic inside options: TouchableFeedbackOptions gives me no information, and I critically need to know what the exact properties are being brought in.
mjbvz commentedon Dec 10, 2019
Moving upstream to get more feedback from the TS Team
Ciantic commentedon Dec 23, 2019
This is same request I had in the diagnostics issue.
Use case I had is that I often found myself seeing a type in the hover tip, and copying it out. It never worked after the changes.
I actually don't understand why the hover tip needs to be abbreviated with three dots. It has a scrollbar. It's perfect abbreviation itself, you can expand it by scrolling! Even if the three dots were expandable by clicking, it would be worse UI in terms of usability, scrolling is easier way to "expand" the view.
P.S. Recursive types are an outlier, I don't mind having dots for them (since it can be infinite). I think in general VSCode should try to show as much as possible of the type, and user can scroll if they wish to see more of the type.
Arlen22 commentedon Dec 23, 2019
Can we somehow make this a VS Code setting? I guess this is in Typescript now, so whatever the equivalent would be here.
Arlen22 commentedon Dec 25, 2019
And now this evening I am diagnosing type problems and it is not showing me a second type that I know is different than the first one that it is showing me. It’s a union on the values of an object and it is only expanding the first type in the union.
DanielRosenwasser commentedon Dec 30, 2019
Just as a heads up, there's a
noErrorTruncationoption which you can set totrue, which I believe gives you the behavior you're looking for.20 remaining items
shwarcu commentedon Feb 5, 2024
This is extremely annoying when working with long types that are calculated and cannot be checked in source

nikelborm commentedon Feb 5, 2024
For those who haven't seen this plugin:
https://marketplace.visualstudio.com/items?itemName=mxsdev.typescript-explorer
wysez commentedon Feb 21, 2024
heysokam commentedon May 1, 2024
Thank you for sharing. Nextlevel useful ✍️
vennson commentedon Jul 1, 2024
Long term solution by @extremegf
in vscode
node_modules/typescript/lib/tsserver.jsornode_modules/typescript/lib/typescript.jsvar defaultMaximumTruncationLength = 1601000or value of your choosing.PS.
noErrorTruncationin tsconfig didn't work for me.Before:

with ...
After:

You can also drag the bottom border
kimhwanhoon commentedon Jul 22, 2024
I'm useing typescript v5, I found that on
tsc.jsnottsserver.js.wertania commentedon Aug 4, 2024
+1
f15u commentedon Sep 10, 2024
EDIT: I fixed it patching
typescript.jsinstead (this is for v5.6.2):Old post:
It used to work in TS 5.4, but now it doesn't (I tried every minor version back to 5.0.4). Even in 5.6, with the following patch, complex types are truncated:
Results in:
I suspect this is related to VS Code updates, even though I'm using the TypeScript workspace version.
SinghChinmay commentedon Sep 24, 2024
Thanks, I was halfway making my extension for vs code, you saved me a lot of time.
extremegf commentedon Sep 25, 2024
I would still happily use your extension :)
pauldvu commentedon Nov 15, 2024
Back to update my workaround :
If you have bun as your package manager you can use the
bun patchcommand in order toensure that your modifications are re-applied after each
bun installStep 1: Run Bun Patch
Step 2: Edit The Package
./patches/[email protected]
Step 3: Commit The Patch
bun patch --commit 'node_modules/typescript'Troubleshooting
Prees Command Shift P
Search " Typescript Select "
*If you don't see this option open a typescript file to active typescript in vscode
Lastly restart the language server
mb21 commentedon Sep 22, 2025
Anybody else where changing
js/ts.hover.maximumLengthin vscode doesn't do anything, or at least not for this case?p-bakker commentedon Nov 3, 2025
Same here, but is due to Astro extension for me, see microsoft/vscode#259321