Skip to content

Full type definition #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dportalesr opened this issue May 18, 2023 · 4 comments
Closed

Full type definition #213

dportalesr opened this issue May 18, 2023 · 4 comments

Comments

@dportalesr
Copy link

When inspecting a type with a long definition, the tooltip triggered by hovering shows basically only a preview of it.

LSP-typescript 🔊-20230518-000603

In my case, "Go to type definition" is not very helpful since my type is an union of other unions which definitions could reside in multiple files.

Is there a way to enable or get (even using other method) the full details of the resolved type? That is, showing the whole list of fields instead of showing "..." or "... n more..."

Thanks in advance!

@rchl
Copy link
Member

rchl commented May 18, 2023

Maybe try with https://www.typescriptlang.org/tsconfig#noErrorTruncation enabled in tsconfig.json.

Note that I've seen reports of this option making type checking a lot slower so probably best to only use it when debugging.

@dportalesr
Copy link
Author

dportalesr commented May 19, 2023

Unfortunately, that didn't work. I also tried with both tsserver.logVerbosity and tsserver.trace settings but no luck whatsoever.

@rchl
Copy link
Member

rchl commented May 19, 2023

Can you provide code sample or project that reproduces?

Note that this is not something that this server would have to support anyway. It's all coming from TypeScript itself.

Personally I've used this snippet that I found on StackOverflow somewhere for cases like this: https://gist.github.com/rchl/9ca0a2bdc95f2c36c4d590572a4d038c (you'd need to modify the code of the type of course).

@dportalesr
Copy link
Author

dportalesr commented May 20, 2023

It seems to happen with inferred types:
microsoft/TypeScript#38557
microsoft/TypeScript#26238

Not an ideal solution but I solved it by changing defaultMaximumTruncationLength = 160 to defaultMaximumTruncationLength = 16000 in tsserver.js as described here, except that since I'm using SublimeText the file I needed to modify was at myProjectRoot/node_modules/typescript/lib/tsserver.js

Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants