-
Notifications
You must be signed in to change notification settings - Fork 401
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
Use a flag to control whether the textEdit of completion will be calculated in resolve request #2584
Comments
Discovered while looking at redhat-developer/eclipseide-jdtls#46 . |
Either smarter or smth else jumps in meanwhile to give it more complete instructions. Can you please share the lsp messages for this completion? Bonus points for teaching me how to see lsp communication in vscode myself :) . |
In vscode, set Tested with the latest pre-release.
So I see the TextEdit is now computed in the resolve call, which I thought was disallowed by the spec (cc @rgrunber @testforstephen ). I'm assuming vscode-java sends a special clientCapabilty to do that. But that means it should still fall back to computing the TextEdit during the completion call, if no capability is declared. |
And this TextEdit has exactly 0 characters length:
This sounds wrong too. |
@puremourning @mfussenegger are you guys seeing this snippet completion issue too? |
I noticed a change after
I wasn't sure if that's okay by the spec so I ended up handling it in nvim-lsp-compl by falling back to I didn't try with the stock core lsp client functionality in Neovim which doesn't support |
This is the particular reason cause of redhat-developer/eclipseide-jdtls#46 . |
A 0-length text edit range is an insert, right. Not strictly wrong in all cases. @fbricon thanks for the heads up but we don't support snippets at all in YCM/ycmd (we're not barbarians 🙃 !). I'll try our regression tests against latest release just in case though. Probably next week. |
See: #1857. It was changed due to perf issue. To be honest it's violating spec (though for a long time till now, it's just working like a charm in VS Code). |
Sigh. |
Yup 0-length is valid, and mentioned in the spec. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEdit . As for the problem being observed when we added As for the snippets themselves, I had a quick look and it doesn't look like JDT-LS supports snippets without resolve. We seem to always set the data fields in anticipating of the resolve call. https://github.com/eclipse/eclipse.jdt.ls/blob/abdc0f87ab9313c1127fd7f263a26c722157424f/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/contentassist/SnippetCompletionProposal.java#L322-L326 I could definitely see it being easier for clients to not have to implement resolve (so we should support that) but can't vouch for how well it may perform. |
@rgrunber What about introducing a flag to control whether the completion will be lazy resolved. (like the discussion before: #2535 (comment)) We can turn it on in VS Code. Other clients can have their own decision. Then everyone will be happy. |
Why bother? The spec accounts for this:
If vscode supports resolving textEdit the. It should announce that. If not, raise a bug against vscode? |
It's not a bug of VS Code. VS Code as a client declares that it does not support update If the Personally, I don't want to change the behavior to get that perf penalty, because the current implementation works for a long time. That's why I propose a flag to control it. |
A flag would be good. Something working in VS code doesn't mean it will work in other editors, especially if you're already aware that it is violating the specification.
If it works in vscode, why don't they add the |
Yeah, exactly - that was my point about vscode being wrong in this case. If it "works", then it should declare it and no random out-of-band flags would be required |
Hmm. My personal understanding: There is no guarantee that it will always work. (Though it looks like in most cases it's working). It seems that there are some cases that lazily resolving TextEdit causes problems:
|
Instead of a new flag, can't jdt.ls use the |
No. Feature flags provide the exact same thing and stay client agnostic. |
And there's already a feature flag for this in the spec :) |
Looks like we agree that using a flag to control the behavior. I can take a look at this in next week. |
I have looked at the test https://github.com/eclipse/eclipse.jdt.ls/blob/abdc0f87ab9313c1127fd7f263a26c722157424f/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java#L1024 and was surprised to see that the CompletionItem doesn't has TextEdit but just insertText . This effectively means that the completion will make it sysoutSystem.out.println(); which is not what's intended IIUC.
The text was updated successfully, but these errors were encountered: