microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.79k stars 29.49k forks source link

Intellisense's 'Suggest selection' should keep working when you have typed something #66019

Open natanfudge opened 5 years ago

natanfudge commented 5 years ago

VSCode has a feature that remembers recent completions the user has selected and then automatically choosen those completions for them the next time. The problem is that it behaves quite oddly, and here is an example that illustrates why:

The problem here is that once you type anything after the suggestion came, vscode will completely disregard your completion history and will just give you the best match lexicographically. Even if in the example you have completed exception by typing an e and then having it complete it, the same thing will occur. My suggestion is that when you have already typed something, the 'suggest selection' will just be filtered by what you have typed, instead of stop working. So in the example, after you have typed e, it will still suggest exception.

"Switch the Suggest Selection settings to "recentlyUsedByPrefix" and it will work!" Yes it does make it sometimes work but overall it makes the situation much worse. For example if you type just console. it won't suggest exception no matter what you have done before.

jrieken commented 5 years ago

Yes - that's the designed and documented behaviour, e.g "Select recent suggestions unless further typing selects one, e.g. console.| -> console.log because log has been completed recently.")" and "Select suggestions based on previous prefixes that have completed those suggestions, e.g. co -> console and con -> const.")". We started this feature with a more sticky variant but good very negative feedback as it would prevent you fro selecting any other suggestion.

E.g. with console and exception what would you expected when typing l, log or still exception?

natanfudge commented 5 years ago

Thanks for the response jrieken. When typing l, I would have expected it to complete log because exception has already been filtered out. On the other hand, when I type e It's pretty obvious I want to type exception again, since exception starts with e. Although when I type er, exception should absolutely not be an option, and error should again be the dominant suggestion.

Another possible scenario is this: I first type console. and complete to time. After this, when I type console.i, technically time was not filtered out. Here there are two options: we either give time priority since it was typed before and not filtered, or we give info priority since it matches better. Here I could see why you would give info priority since it's a stretch to say that when I type i I mean to type time. Although, in the example I showed (with the error/exception), exception is a very good match, and so should definitely should still be suggested, and not error.

So to sum up my opinion:

jrieken commented 5 years ago

Ok, that's kind of what it does today "Select recent suggestions unless further typing selects one". The thing is that e and error or e and exception score equally well and that then the original order (alphabetical) is used to make a decision. I can check if we can use the history instead.