GeezerVison is showing github.com — favor local types and values in autocomplete popup over ambients declaration · Issue #15024 · microsoft/TypeScript
favor local types and values in autocomplete popup over ambients declaration #15024Descriptionit's not clear to me what drives the order of the list of autocomplete popup suggestions, i wish my local types and values were listed first, and ambients came after them Reacted by Aluan Haddad, Tingan Ho, Matt Bierner, Marin Marinov, Florian Bienefelt, Sami, Nicolas HENRY, Tomasz Błachut, Alexey Morozov, movedoa and 13 more Activitymjbvz commented on Jun 30, 2017 This was reported against VSCode recently as well: microsoft/vscode#29613
For code such as:
The suggestions for can have the same sort text:
{
"name": "cancel",
"kind": "var",
"kindModifiers": "",
"sortText": "0"
},
{
"name": "cancelAnimationFrame",
"kind": "function",
"kindModifiers": "declare",
"sortText": "0"
}
I believe that variables and parameters should have a higher sort text (or that globals should have a lower sort text) Reacted by Marin Marinov, Mike Pugh and Sami mhegazy commented on Aug 29, 2017 A feature that VS has today is remembering the last entry the user selected in the completion list. so the first time you type cancel it does not get it, but next time it gets a preferential treatment. I think this is a general feature that would be beneficial to VSCode users in general given the locality of reference for variables in general, and less disorienting as reordering based on scope.

mhegazy commented on Aug 29, 2017 lifehackett commented on Sep 22, 2017 I'd still prefer local scope to get higher weighting. The remembering of the last selection only solves a small subset of the use cases that I care about. Reacted by Mike Pugh, brerneto and suchoss mjbvz commented on Jan 9, 2019 VS Code has added support for remembering suggestions with the editor.suggestSelection setting.
I still think that adding some basic sorting based on scope would be very helpful. Daniel Rosenwasser (@DanielRosenwasser) Can we revisit this feature request? Reacted by Daniel Rosenwasser and Marin Marinov RyanCavanaugh commented on Mar 14, 2019 mjbvz commented on Mar 22, 2019 zpdDG4gta8XKpMCd commented on Mar 25, 2019 there is also a very annoying thing with remembering-last-entry bonus:
- say i needed
[].filter but by accident i picked [].fill now the fill gets preference over filter and gets on the way even more often, so i pick it by accident even more, and it all goes in a vicious circle
how do i unfavor some accidental picks? Reacted by SlurpTheo and Agostino Carandente SlurpTheo commented on Apr 11, 2019 ZpdDG4gta (@zpdDG4gta8XKpMCd)
how do i unfavor some accidental picks?
If you Undo (Ctrl+Z) after accidentally selecting fill, I'd expect it to not leave fill in that "last list". Reacted by Adam Rutkowski RyanCavanaugh commented on Apr 18, 2019 The ordering we think might be best:
- Things from the lexical scope that are declared in the current file (including top-level variables in a script file)
- Suggested class members
- Things from global lexical scope and keywords
- Auto-import suggestions
Caveat: "real" things (non-suggestions) should always shadow suggestions Reacted by Nicolas HENRY, ZpdDG4gta, Andrii Dieiev, Adam Rutkowski, Sean May, Benas Svipas and Agostino Carandente sheetalkamat commented on May 16, 2019 Ryan Cavanaugh (@RyanCavanaugh) Matt Bierner (@mjbvz)
In example from #30013 making Things from the lexical scope that are declared in the current file (including top-level variables in a script file) as first makes suggested class members render

Also what happens to javascript symbols. Current behavior is that everything except JavaScript has "0" and JavaScript symbols are "1". Does JavaScript come after auto import ? mjbvz commented on May 17, 2019 Yeah that doesn't feel right. We should either:
- Merge the class member and lexical scope precedences.
- Introduce two levels of lexical scoping:
- Locals (things from inside the current method)
- class members
- File Lexical scope
- global lexical scope and keywords
- Auto-import suggestions
The first approach definitely seems more straightforward. VS Code's suggestion sorting should also help out so that better matches are shown first
For the second point, the javascript symbol suggestions (we call them name suggestions in vscode) should probably have the lowest precedence. They are sort of the equivalent of VS Code's word based suggestions, which also have very low precedence and are only really meant to show up when no other suggestions match zpdDG4gta8XKpMCd commented on May 17, 2019 how about we give it as a configurable option?
something like:
{
"auto-completion-priorities": ["locals", "members", "lexical", "ambients", "imports"]
}
or
{
"auto-completion-priorities": "merged"
}zpdDG4gta8XKpMCd commented on May 17, 2019 it would be nice to have some visible separation between the groups (shades of background) zpdDG4gta8XKpMCd commented on May 17, 2019 better yet first N.. something items of each group with an option to dig deeper:
aaaa
aaab
aaac
aaad
... more locals
bbba
bbbb
bbbc
bbbd
... more globals
and please make N configurable (per each group)
... looks like an overkill, disregard please added a commit that references this issue on May 20, 2019This issue will close once commit 00cea41 is merged into the 'main' branch.00cea41
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|