sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin
MIT License
135 stars 11 forks source link

Toggling inlay hints #134

Closed alecmev closed 1 year ago

alecmev commented 2 years ago

They're super useful on functions with lots of arguments, but get in the way in simple calls like this:

const y = data.filter(x => x > 0);

The predicate: in front of x makes it less readable, not more. Another reason is that sometimes I use a pretty narrow window, just wide enough to fit in 80 characters, and with hints enabled I need to scroll horizontally now.

So it would be nice to just have this "X-ray" that I can turn on only when I encounter a big function call, and can't quickly decipher what means what, and keep it off by default.

Is it possible? Something that doesn't require a server restart?

P.S. Thank you for implementing this!

rchl commented 2 years ago

I would imagine this to be controlled by the LSP package itself.

But first both the https://github.com/typescript-language-server/typescript-language-server and https://github.com/sublimelsp/LSP would have to implement the official Inline Hints spec.

Then the server would always have inline hints enabled and LSP would control whether those should be shown or not.

predragnikolic commented 1 year ago

Done with https://github.com/sublimelsp/LSP/pull/2023

alecmev commented 1 year ago

Thank you! :tada: Works like a charm.