-
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
CompletionItemProvider#resolve not always called #26622
Comments
The text edit, better the range and insertText, is needed early on before filtering and scoring happens because they play a role in how that works. Otherwise sorting would change when going up and down in the list of suggestions. Because of that it is unlikely that we simple allow to change these things after the fact (that we do is maybe the actual bug) |
It is not at all clear from the language-server specification that the text edits aren't supposed to be lazy resolved. By my reading of it, I was assuming that lazy resolution of both the edits and the doc strings would be something one might do 'lazyly'. Now, I went back to the spec and I have to admit this is more based on my own intuition and the fact that both computing complex set of edits and doc strings could be something 'expensive'. It is not really somthing spec says literally. In fact, the spec doesn't seem to say what qualifies as 'additional information' that is computed by lazy resolution. Yes, I understand your comment about sorting, but that is really not that intuitive at all, especially given the fact that language server spec also includes a sort string in the item (which now, as I understand, is, for the most part, being ignored by vscode, in most cases). I think there's a bit of a dilemma here that
I do think this 'dilemma' is probably more of an idiosyncracy in vsode's implementation/interpretation of the spec. I would guess that other language server client implementation, probably don't use the edit text in this way. Call it an educated guess, I have not confirmed this, but simply relying on the sortText for sorting is the more straighforward way to interpret the spec. |
Assigining to @dbaeumer for the LSP discussion. We have no plan on changing how items are sorted and since that depends on the text edit that cannot be lazy in VS Code. |
@jrieken can you enlighten me why the sorting depends on text edits. I can easily argue that we need the label, sort text, ... |
... and shouldn't we document that in the vscode.d.ts as well. It is not just LSP being underspecified :-) |
@jrieken can correct me if I'm wrong, but I think this is because vscode is trying to sort based on 'relevance' (and mostly ignores the We had lengthy discussion about this in the past: #26096 |
I clarified this in the spec and made only documentation and detail lazy resolvable. If we think that other clients can handle more lazy attributes or want to change this I propose we introduce a capability that describes which properties can be lazy. However I first would wait for someone asking for this. |
Closing. Changes happened in vscode-languageserver-node and language-server-protocol. |
Steps to Reproduce:
The
<*>
marks the cursor/caret position. So delete it and place cursor there.Press CTRL-SPACE to invoke content assist.
Now, in order to see the problem. Only use the mouse to invoke the last proposal in the list. I.e Do not use the cursor keys, also Do no type to narrow the proposals. Instead, scroll-down (using mouse or scrollwheel) to the last proposal its text is
← ← - name
. Then click the proposal with the mouse to invoke it.=> Observe: The completion simply inserts the label text. So the editor contents becomes this:
This is wrong. Compare this to the intended/correct behaviour which you can get by using cursor keys (instead of mouse) to move down and select the proposal, then press
ENTER
to invoke it. In this case the editor contents becomes this:I speculate that the reason for the discrepancy is as follows:
The text was updated successfully, but these errors were encountered: