Closed OliverSchmitt closed 5 years ago
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
@OliverSchmitt can you provide a test case (best based on the completion item sample) that demos this using pure VS Code extension API
Yes, I can. I actually already did that in this issue.
Seems to work just fine. What is your issue? Can you add steps, expected and actual behaviour?
You triggered the completion by pressing ctrl+space
, right? It does work for me if I do that as well.
I am starting to think the issue might be the trigger kind because I noticed different behavior depending on how the completion is triggered.
a) Steps:
ctrl+space
Result:
b) Steps:
L
Result:
c) Steps:
La
Result:
d) Steps:
ctrl+space
La
Result:
If I test the same cases with the insertText
instead of the textEdit
property of the CompletionItem
case b) and c) have the same results as case d), also with the prefix highlighting.
This is because the completion using the textEdit
always uses the current position as range. The range is the "text selection" that is to be replaced and therefore it also defines what prefix is used for filtering/sorting. If there is no prefix (no text selection, range is cursor position) then there is nothing to compare against with. When not having a prefix, the default is the current word. When showing suggestions, press Cmd/Ctrl+/
so get a explainer.
We have a great developer community over on slack where extension authors help each other. This is a great place for you to ask questions and find support.
Happy Coding!
When implementing a Language Server that supports the Language Server Protocol VS Code does not behave according to the specification in a certain case. The case includes using the textEdit and sortText simultaneously while providing a list of CompletionItems for the completion request. In this case the sortText property is ignored.
Examples for the problem using the VS Code completion and the pygls language server framework for python can be found in this issue against the Language Server Protocol. This seems to be an issue effecting different language server implementations as well as different language clients.