sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Full type definition

dportalesr opened this issue · comments

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!

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.

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

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).

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!