-
Notifications
You must be signed in to change notification settings - Fork 408
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
Inconsistent filterText and textEdit are returned, violating the LSP spec #1348
Comments
The |
Filter against what? Note that the servers may return whatever filterText they want - e. g. xml language server returns here it is eclipse lsp4e prefix calculation: https://git.eclipse.org/c/lsp4e/lsp4e.git/tree/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSIncompleteCompletionProposal.java#n378 For the record, when you do |
@Eskibear could you take a look here? |
I just tried:
According to the log, jdtls returns the same response in both cases. However, in Case 1 target class was shown in the completion list, while in Case 2 only sub packages were shown. E.g. I wanted to refer Case 1{
"label": "AbstractExecutorService - java.util.concurrent",
"kind": 6,
"detail": "java.util.concurrent.AbstractExecutorService",
"sortText": "999999212",
"filterText": "AbstractExecutorService", // <-- same filter text
"insertText": "AbstractExecutorService",
"insertTextFormat": 2,
"textEdit": {
"range": {
"start": {
"line": 2,
"character": 28
},
"end": {
"line": 2,
"character": 28
}
},
"newText": "AbstractExecutorService;"// <-- different new text
},
...
}, Case 2{
"label": "AbstractExecutorService - java.util.concurrent",
"kind": 6,
"detail": "java.util.concurrent.AbstractExecutorService",
"sortText": "999999180",
"filterText": "AbstractExecutorService", // <-- same filter text
"insertText": "AbstractExecutorService",
"insertTextFormat": 2,
"textEdit": {
"range": {
"start": {
"line": 9,
"character": 8
},
"end": {
"line": 9,
"character": 29
}
},
"newText": "java.util.concurrent.AbstractExecutorService" // <-- different new text
},
...
}, I guess it's because in Case 2, instead of an empty string, vscode filtered the items using the full line |
That is because JDT LS returns incorrect text range in |
You are right. So I can see two possible solutions for this case:
And I think b) makes more sense. |
Well, I just had a glance, the |
That's correct - the range serves as the range that is replaced upon insertion and selects the prefix that's used for filtering and sorting. |
I guess option a) is still on the table? IMO it won't make any difference for the clients unless they are putting the completion dialog under the |
I was trying to update The highlighted part of Back to this issue, I think the perfect solution would be, to use a textEdit with more reasonable range and newText, which is far more complicated. To some extent, it does unblock the use case... not perfect though. |
@Eskibear what about having the filterText patch merged and then when upstream is fixed it will automatically resolve the highlighting issue?
We (at emacs side) do it the same way. IMO the issue is not that the filterText is different from the label but the fact that the prefix is different(the prefix is calculated based on the textEdit). |
@yyoncho you're right. I've updated the original statement to avoid confusion. |
Completing the following line:
In this case the server returns:
As per spec the clients are supposed to use the textEdit range to find out where the completion has started and then filter it against filterText. In this case, the completion of prefix is calculated as
java.util.concurrent.atomic.
while the filter text isAtomicBoolean
.The text was updated successfully, but these errors were encountered: