-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Completions in VS Code #400
Comments
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
I found that the fix in PR #398 has caused some new issues. In my understanding, For example, in Neovim, there is now frequent flickering when completing structs, which was not the case before. nowCleanShot.2023-10-14.at.15.18.49.mp4Before(Better UX)CleanShot.2023-10-14.at.15.16.52-converted.mp4Regarding the thing you mentioned in reference [^2], I also think it is a bug because other clients can handle this aspect well. Therefore, I also think we should not return all completion results in the same format with |
You're correct, @scottming -- this is a UX regression from #398. If we start returning completions for single-character prefixes (#410 does this for all completions except atoms), we can revert #398. The problem is that, for VS Code, it seems to be all or nothing: return all possible completions on the first character, or no completions will be shown at all for subsequent input until a trigger character or new word is seen. |
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
Related: #400 VS Code in particular handles empty completions lists very poorly, refusing to make further completion requests. This commit removes the logic that was preventing completions from being returned when the prefix is a single character.
This commit improves completions for the general case and adds special handling when the client is VS Code that fixes numerous issues related to completions in that editor. General improvements: * Partially revert #398, which introduced a UX regression that caused slow/high latency completions. * Don't insert additional, unnecessary newlines with multi-line snippets. * Improved snippets for `defdelegate`, `defguard`, `defguardp`, `with`. * Consistent capitalization and naming in completion labels. * Fix a bug that caused a do/end block completion to be proposed when the cursor was after `@do`, which would occur whenever typing `@doc`. VS Code: VS Code has some problematic behavior when dealing with empty completion lists. When the client is VS Code, we now attempt to never send empty completion lists if it is possible that further typing will result in some completions. Instead, we send a larger list up front and allow the editor to filter. See #400 for more context. --------- Co-authored-by: Scott Ming <[email protected]>
Behavior in VS Code was much improved by #410, but I'd like to leave this issue open to make it hopefully easier to track the upstream issues in VS Code and as context for people coming here to report other potential issues with VS Code completions. |
@zachallaun I don't like long-lived issues, unless they're tracking several sub-issues. Can we either close this or provide a set of tasks that when completed would close this issue? |
@scohen There are (at least) 2 features we can't have, at least for VS Code, until related issues are resolved. I added them to the top of the OP. |
Thank you! |
The following improvements cannot be made until related issues in VS Code are resolved:
isIncomplete=true
to include more/less completions based on context as the user types.While doing some work on completions, I found a number of VS Code issues that affect completions pretty significantly. The workarounds for these may need to occur both here and in lexical-lsp/vscode-lexical, so I'm creating a single tracking issue to consolidate information for now.
When a completion request is issued by the client, the response from the server can optionally set an
isIncomplete
flag. If it's set totrue
, according to the spec1: "This list is not complete. Further typing should result in recomputing this list." This means that further typing could add/reorder items.Without
isIncomplete
set totrue
, VS Code makes the assumption that the initial set of items is complete, and further characters in the same "word" are filtered client-side. This means that for each word, only a single completion request will be issued. This led to some completions never appearing in VS Code, fixed by #398.Unfortunately, this fix isn't complete: VS Code has what I think must be considered a bug2: If a completion result is empty, i.e. the list of completion items is
[]
, even ifisIncomplete
is set totrue
, VS Code will not issue additional completion requests. So if we return no completions on the first character, VS Code will never show additional completions from the server.There have been additional issues and suggestions34 for how VS Code's behavior should be improved, but I think all of them hinge on the original bug being resolved.
Looking through the linked issues, multiple language servers have tried various workarounds. For now, however, it may be necessary to move away from using
isIncomplete
if possible and always return the full set of completions on the first character.Footnotes
LSP Specification:
textDocument/completion
↩Support CompletionList.isIncomplete=true on empty lists (or at least, clearly document current behaviour) microsoft/vscode#155738 ↩
Filter completion client-side even if the LSP returns incomplete results microsoft/vscode#168329 ↩
CompletionList.isIncomplete=true results in showing "stale" results when typing quickly due to cancelled requests microsoft/vscode#147830 ↩
The text was updated successfully, but these errors were encountered: