denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.79k stars 5.34k forks source link

truncate inlay hint by setting #26243

Open jakubdonovan opened 1 week ago

jakubdonovan commented 1 week ago

I would like to request a feature to truncate inlay hints via a setting, similar to how VTSLS handles it. This would allow for cleaner, more concise hints in the editor, improving readability.

Could you add a setting to control inlay hint truncation?

https://github.com/yioneko/vtsls/commit/95b51bde14b098ffb4760630821027c6a2fe84da

nayeemrmn commented 1 week ago

Inlay hints are directly driven by the embedded ts server. We could technically implement it ourselves but I would prefer if the suggestion was implemented upstream and we inherited it. Unless you can find a vscode setting that does this, and we can respect it.

jakubdonovan commented 1 week ago

Inlay hints are directly driven by the embedded ts server. We could technically implement it ourselves but I would prefer if the suggestion was implemented upstream and we inherited it. Unless you can find a vscode setting that does this, and we can respect it.

VSC trunctates them at 30 characters by default. https://github.com/microsoft/vscode/issues/199610

nayeemrmn commented 1 week ago

Then analogously it should be implemented in the editor or client-side plugin. I think you were using denols with vim?

jakubdonovan commented 1 week ago

Then analogously it should be implemented in the editor or client-side plugin. I think you were using denols with vim?

Yes, I’m using denols with neovim via lspconfig. VTSLS recently added this feature in their tsserver wrapper, so it’d be great to have it here too as inlayHints (especially functionReturnTypes) get very long, sometimes taking up more than 3 lines.

https://github.com/neovim/neovim/issues/27240#issuecomment-2053854899

server based "smarter" truncation based on what's semantically relevant" sounds like the right direction