-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
Autocompletion should have fallback to simple matching #15411
Comments
We do exactly that. When a higher ranked completion provider doesn't return a result we fallback to word-based completions. Assigning to @ramya-rao-a to make sure vscode-go actually returns nothing in that case |
Not touched that setting; it's on. I think there's one or more extensions that are screwing with the built-in suggestion system. I just disabled all the plugins and found that enabling this one breaks everything. I'm going to see if there are any other extensions that also break things. |
Reopening to understand how that is possible. Extensions shouldn't have the power to stop word-based suggestions... |
There is bug on our side that we don't but the completion provider from |
Nice, thanks. |
@jrieken I encountered another problem which I'm not sure whether is a regression or something specific to snippet handling, or what. With
Whereas this doesn't:
Is this snippet functionality ( |
I tried your example (replaced I was able to get the right suggestions in both cases. What are your settings? |
@ramya-rao-a This is weird, it was absolutely not working for me the other day for one specific use case, and I thought my test case reproduced it... but now I can't reproduce it the way I thought I did. It might be a special edge case, but of course I can't remember what file I was working in either. However, my comment above has a syntax error, which reveals another edge case (which may or may not be the same one): Notice the syntax error. I don't think the autocomplete is falling back to string matching at all, or it would have shown the string from the declaration that contains the syntax error. Notice, by the way, how it affects type declarations but not constants: Obviously this is not a real use case, but I often edit a file with syntax errors (because I'm in the middle of shuffling things around, copying and pasting and so on), and I expect autocompletion to be consistent even then. |
In your first case where you get In the second case, where syntax errors result in missing suggestions, this would be a bug on the |
But that's my point — string matching should always be included, no matter what the extension has provided. I don't consider But I'm afraid I don't understand the string-matching heuristics at all. For example, if I have this:
Here, |
I see this too. @jrieken Basically there are 2 questions here
|
Thanks. Just to point out (as noted before), your first bullet point also encompasses snippets, which why I mentioned this earlier. Here, there are three oddities:
Again, difficult to see where one bug begins and another starts. There might be several issues here. |
Each provider gets a rank depending on the selector it uses when registering. The word based provider usually has the lowest score and the rule is that lower ranked providers aren't asked if higher ranked providers produced a result. That is to avoid duplicates and spam.
Depends. When a provider registers trigger characters like |
Atom has a nice behaviour where autocompletion can fall back to a simple string-matching mode that matches terms within the same document, which is extremely useful to reduce typing even though there's no grammar.
In my opinion, this should be available even when the current scope has a grammar, such as Go. For example, one thing I do all the time is write a call to a function before I've defined that function. So I'll do something like:
Even though there's no function
loadDataFromFile
defined yet, the autocompletion should offer it as a match forloadD
, because it's in the file. (Having a "create function loadDataFromFile" command at the call site would obviously be even better, but this is just one example of many.)This kind of autocompletion is also super useful in purely-plaintext or other non-grammatical scopes, including comments, Markdown, and so on.
The text was updated successfully, but these errors were encountered: