-
Notifications
You must be signed in to change notification settings - Fork 27.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remembered suggestion selections can be annoying #41060
Comments
The reason for that is that VS Code remembers selected suggestions per prefix and language. When typing Not yet sure how to handle these situations as there are cases. In some scenarios the same prefix is used for different suggestions in an alternating fashion... Open for suggestions |
The current approach feels like it's trying to be too smart. If we have a case sensitive exact match I feel like that should always override a predictive match. Do we have scenarios where this isn't the case? Alternatively, if I had entered 'ac' and then pressed tab, then yes I can see ActorMgr matching. Then again, case sensitivity is something I'm very aware of when I code, so I feel it should still put 'actor' first. Possible rules: 1, Exact match always wins A few other thots: // Can I turn off "suggestion matching" and enable case-sensitive-exact-match-wins intellisense? Isn't this how intellisense used to work? // It's unclear to me this kind of matching will ever work in code bases with variables / class names that share common sub-strings. Which I would guess is most code bases. Consider a code base which has actor, ActorMgr and ActorCtrl. If I use all of these frequently intellisense is going to guess incorrectly 66% of the time. Just because I used 'actor' last time does not mean I will use it this time. The more I think about it the more I'm convinced this just won't work -- it's just too easy to guess incorrectly. I can see cases for "auto-correction" e.g. if I type 'actro' and I've used 'actor' several times in this context before, perhaps it should auto-correct to 'actor'? (Below are more ideas... they might help in some cases, but I think the feature has fundamental challenges.) // Perhaps we only suggest after we have context. Consider... I enter "actor", no suggesting, just case-sensitive intellisense ... again this presents challenges. If actor has an Animator and an AnimatorManager, it will guess incorrectly half the time. // Visual highlighting of the "current match" should be stronger, I don't think this will help much but it will at least make things more obvious. // Can we better leverage context? It feels like we currently remember selections by project...? Could matches be relative to the code file, class or even function? Not sure this really helps, might make things more confusing actually :). // What means do we have to "override" a match. Consider... 1, Entering 'actor' pressing tab ... backspacing and then escaping out of the suggestions definitely has intent from where I am sitting, can the system reliable leverage that? Perhaps escaping when there is an exact match matters? |
Just wanted to add to this... I'm now more confused as to how the suggestion system works. Consider below... ... having entered '_canRo' how is it that '_canGuardCounter' or '_canChargeCounter' match? Further, how is that _canGuardCounter is the selected match? I see that the letters 'r' and 'o' are in *GuardCounter and *ChargeCounter but I would have to be a really bad typist to have entered _canRo and expect either of the suggested options. (By the way, I know how hard everyone works on these features... I don't in any way want to come across as not appreciating all that hard work -- I've been in your shoes :). At the same time I want to help improve VS Code b/c it's the tool I use everyday. If I'm negative or direct, it's only b/c I've found that's the fastest way to make something better. It's never personal.) |
Consider two sides of this: Sorting and Selection. The sorting is based on a rank that is computed with the current prefix and each suggestion. From looking at your screen shots the sorting is correct (better matches comes first). Now selection: By default the first item in the list is selected, it's the best match. However, if a user selects a different suggestion (not the best match) for a prefix we remember that and we will select that item the next time this case comes up. So that's what's happening here, your problem isn't sorting but pre-selection. You can easily "fix" this by just accepting a different suggestion and we believe depending on the current task that happens. For instance I usually complete
see https://hackernoon.com/heres-to-fat-fingers-f39a5c778c4c So, given the new insights how can the remembering be improved? Suggestions, Ideas? |
Thanks for the context. Helpful. A few ideas:
3b. Reading the hackernoon article... it seems we want to auto-correct for cases in which a dev swaps two letters "accidently" -- not sure what you call this, feels like a form of Spoonerism. But we don't want, although seem to currently have, "deep-matching" of just any singleton values across a string. For instance, we want
|
Hello - Interesting discussion. I'm running into this issue in my current project as well where the autocomplete suggestions appeared to insert the wrong item. I realized that the suggestions were "remembering" the previous selection and that's what led me here. I'd argue that similar variable names and "interleaving" them while coding is not rare at all. By making the selection feature smart, it feels like the UX takes control away from the user instead. For example, I have Client and Server implementations of several objects and as I work back and forth intellisense (subjectively) feels like it's always picking the wrong one. It's definitely slowing me down with extra keystrokes, deletions and interrupted focus. I would love it if I there were a setting to disable the remembered selection and always default to the best match at the top of the autocomplete list. That would let folks pick the behavior that matches their work style. |
@chronicgamedev Thanks for the feedback... Adding a setting is always in reach but also less ideal because folks need to discover and we all need to argue about the default ;-) The client, server sample is good input. Today we remember things per language but maybe we should store it per file. So instead such a key |
Never fun to realise the dev team isn't actually reading your comments... I suggested scoping things in my second comment...
Good to see you read @chronicgamedev's note, but now I feel like I'm just wasting my time here :|. |
Hi there. Interesting discussion indeed, from both user and extension writer perspectives. |
I unwittingly opened a duplicate bug, because it's very unclear what the autocomplete behavior actually is. IMO a strong hint that it is "too smart." FWIW, this issue is costing me ridiculous amounts of productivity, as I constantly have to correct the autocomplete, being careful to step around it even though I'm just typing a word verbatim. I'm running into this every few minutes, so I feel like this can't possibly be the best behavior. Yet I'm also very reluctant to turn off autocomplete entirely, so I'm not sure what the solution is. It's been stated that VSCode is remembering a past selection. Well, how did all of these erroneous selections get selected to begin with? In my case, I'm seeing extremely common names autocompleted with names I would never, ever have any reason to select on purpose. It's definitely helpful to learn that I can "fix" it by selecting the correct name from the dropdown. But I'm encountering this issue all day, every day, to the point that it's becoming one of my single biggest editing time-sinks. I think for now my best option is to turn off editor.acceptSuggestionOnCommitCharacter. |
I'm encountering similar problems with completions, for me it's manifesting itself mostly while writing tests. That very sticky suggested completion of Remembering my last choice feels counter-intuitive to me, and I would much prefer simply getting the first result of the suggested list highlighted (benefitting from the already weighted and sorted list of completions). |
Trying to improve this and the plan is to limit the memory to the top bucket. In the scenario below there are two equal matches (both score 40 as the suggest-debug-mode shows) and we would remember if Now in the scenario below there is only one top suggestion and we will always select that. In addition to that we can also limit storage further, e.g instead of scoping to the language, scope to the file (we unfortunately don't have project information at this level) and we can also turn this off via a setting. Still, I'd like to make those changes and see how/if that removes annoyances first. Then we take the bigger hammer. |
I have pushed b4ee65d which implements the above mentioned strategy. Limiting the suggestion memory to the top bucket will make suggest behave like so. Please try this out with the next insiders release. Thanks for helping! |
@jrieken - How do I turn on suggest-debug-mode? |
For now only in source by uncommenting this line. Tho I have a todo to expose that in some way |
Sorry, can I ask - is there a way to turn this feature off. When you set up your own code snippets this feature is infuriating, in the sense that unless you call your snippet nothing to do with what it does like "ttt" if defaults to other suggestions. See this thread on StackOverflow https://stackoverflow.com/questions/48304160/over-ride-default-snippet-prefix-in-vs-code/48305768#48305768 |
@emilyChewsCheese Please try this with latest insiders: https://code.visualstudio.com/insiders/. The problem that you are describing has been fixed (as described here #41060 (comment)) |
@squalsoft Not sure that you are on the right issue. This issue is about selecting a completion which isn't the top completion in the list. You screen shot shows that the first/top completion is selected. |
I'd say that a miss-understanding of what I said. What I wanted to get across is that I first want to improve how the feature works (hard) and then add a setting (easy). Ideally, a feature works so well that it doesn't need a switch to be turned off. There are many people, like you and I, that deeply care about this. I see that some people are upset by the latest changes and I want to understand why. Yes, plain dislike is one kind of feedback but little actionable. @shraddha-kapoor, @tempit In the hunt for actionable feedback: Did you try this with recent Insiders which has been improved in this respect? Did you never encounter a situation in which you have typed See, I wanna understand how you use IntelliSense and how/when the feature gets into the way. It's great that you care and I like understand and learn how you do it and what you are wishing for. |
@jrieken - Did not mean to offend; my original feedback is in one of the earlier comments. I have encountered this issue since, when trying to refactor a bit of code, and either calling new variables 'newVar1', 'newVar2', 'newVar3' etc. or renaming old vars to 'oldVar1', etc. (names made up for clarity) I have not tried it in the insiders version, since from what I understood about the current improvement it would not fix this issue. I also have encountered this issue on the extension development side, where my suggested completions have the same score, and so would not be affected by the fix, if I got it correctly. |
@jrieken Just wondering: can the "smart suggestions" just go up in suggest widget? I kinda like the idea, but having to visually search for selected item is not so great... con
// before
--------------
confirm
--------------
console
--------------
const selected (remembered)
--------------
// after
--------------
const selected (remembered)
--------------
confirm
--------------
console
-------------- Also, having an indicator why this item is selected(or above) would be nice. |
@usernamehw Yeah, we did discuss that. We have been throwing ideas around which are similar, remembered suggestions could show above 'normal' suggestion or just below. I didn't go deeper on that because I don't wanna confuse people further as the sorting suddenly becomes hard to understand (and you needing to read/understand those history items). What I have pushed now is changes to make this less confusing. However, now that we have a setting we can explore different idea too. |
the solution sounds pretty good, thanks for considering all the feedback. |
Closing as we now have a setting and because the default has been made less annoying. Added the feature-label to make sure we test this during this weeks endgame. |
Guys please test |
After playing with it briefly in insiders I can confirm the different options work as described (for me). The option I will be using once this make it to the main version is 'never', since in my workflow when I have 'newVar', 'newClass', 'newType' etc. I don't want vscode remembering which one I used, as that constantly changes. I do think the names of both the setting and the values are confusing now, I had to refer back here to understand which is which. Thanks for the responsiveness and all the work! |
Thanks. The names aren't set in stone (yet) and I'd like to hear other opinions about this too |
Been using the insiders build for the last couple of days - seems that the new default of In addition, I agree with @tempit that the current names are confusing, the difference between |
We have changed the names of the settings and its values. See #42477 (comment) |
For people coming here looking for what the settings
Awesome to see this be addressed and actually resolved with a pile of thought and community involvement 👍 EDIT: Oh I see in the commit there are actually descriptions tagged against the enum values… how does one view these? 🤔 |
When I used |
Steps to Reproduce:
https://imgur.com/lpt0DKg
Expect:
If I type in an exact match, then that should be the value I will get after tabbing / entering, not the next closest match.
The text was updated successfully, but these errors were encountered: