Expose completion entry symbol for plugins API #51936
Labels
API
Relates to the public API for TypeScript
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Uh oh!
There was an error while loading. Please reload this page.
Suggestion
🔍 Search Terms
languageService.getCompletionEntrySymbol
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Hi! I don't have very deep knowledge of TS internals, but it seems very obvious that completion entries are coming from symbols and getting that symbol information per entry is not possible in any way (calling
getCompletionEntrySymbol
for every entry seems to be inefficient inside ofgetCompletionsAtPosition
as it calles it).📃 Motivating Example and 💻 Use Cases
plugin
Probably absolutely any plugin that wants to improve or change existing completions lists, so I can imagine hundreds of hundreds use cases. But I have a few real world cases that I really need sometimes. For example removing marking (or even removing some) global symbol completions:
With this patch I can get it (in my case it just adds
symbol
in%LOCALAPPDATA%\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js
at L135650):Another (but more advanced) cases would be:
<Foo[||]>
insertText
of object literal property completion depending on JSDoc tags (for example@default
)... also changing sorting, insertText or even removing completions depending on contextual or declaration type or fileName (location) of where symbol is declared.
There are no workarounds known for me! (except of manually getting container and symbols of it), but it might become out of sync if manually maintained in plugin.
The text was updated successfully, but these errors were encountered: