-
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
Lazily resolve completion text edit according to the preference #2600
Lazily resolve completion text edit according to the preference #2600
Conversation
- JDT.LS will only resolve the text edit for the snippets only when the preference 'java.completion.lazyResolveTextEdit.enabled' is set to true. - If not, the 'textEdit' of the snippets will be set during 'textDocument/completion'. Signed-off-by: Sheng Chen <sheche@microsoft.com>
685cd43
to
e9b0dea
Compare
In LSP4E (which may not be perfect), I see the issue the other way round with this patch: the LS return |
So is the text edit lazy resolve turned on or off in you case? I cannot understand why the range of the textedit in your attached response is zero. |
Here are the full capabilities, the interesting part is {"jsonrpc":"2.0","id":"1","method":"initialize","params":{"processId":813393,"rootPath":"/home/mistria/sandbox/eclipse-workspace/blah/","rootUri":"file:///home/mistria/sandbox/eclipse-workspace/blah/","initializationOptions":{"extendedClientCapabilities":{"classFileContentsSupport":true,"skipProjectConfiguration":true,"excludedMarkerTypes":["org.eclipse.lsp4e.diagnostic"],"skipTextEventPropagation":true},"settings":{"java":{"implementationsCodeLens":{"enabled":false},"project":{"resourceFilters":""},"referencesCodeLens":{"enabled":false}}}},"capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","delete","rename"],"failureHandling":"undo"},"symbol":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true},"workspaceFolders":true,"configuration":true},"textDocument":{"synchronization":{"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"completionItem":{"snippetSupport":true,"documentationFormat":["markdown","plaintext"],"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}}},"hover":{"contentFormat":["markdown","plaintext"]},"signatureHelp":{},"references":{},"documentHighlight":{},"documentSymbol":{"symbolKind":{"valueSet":[18,17,5,14,9,10,22,24,8,1,12,11,20,6,2,3,21,16,19,25,4,7,15,23,26,13]},"hierarchicalDocumentSymbolSupport":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{},"definition":{"linkSupport":true},"typeDefinition":{"linkSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"resolveSupport":{"properties":["edit"]},"dynamicRegistration":true},"codeLens":{},"documentLink":{},"colorProvider":{},"rename":{"prepareSupport":true},"foldingRange":{},"selectionRange":{},"inlayHint":{}},"window":{"workDoneProgress":true,"showMessage":{},"showDocument":{"support":true}}},"clientInfo":{"name":"Eclipse Platform","version":"0.16.1.qualifier"},"trace":"off","workspaceFolders":[{"uri":"file:///home/mistria/sandbox/eclipse-workspace/blah/","name":"blah"},{"uri":"file:///home/mistria/fosdem/workspace-demo/hello/","name":"hello"},{"uri":"file:///home/mistria/runtime-Test-EclipesWithJDTLS/languageServers-log/","name":"languageServers-log"},{"uri":"file:///home/mistria/git/lsp4e/org.eclipse.lsp4e.debug/","name":"org.eclipse.lsp4e.debug"},{"uri":"file:///home/mistria/git/lsp4e/org.eclipse.lsp4e.test/","name":"org.eclipse.lsp4e.test"}]}}
We call resolve relatively early, when selecting the completion item (at this stage |
Oh, sorry I forgot to update the title and description. According to the suggestion: redhat-developer/vscode-java#3072 (comment), this PR has changed to use a preference to control the behavior. By default the setting is false at the server side. I assume in your case, the text edit is not lazy resolved, so it will calculated in the request Not quite familiar with the Eclipse side implementation. In VS Code, following things will happen during completion:
See here, the range of the text edit is determined by token start and token end. Why it becomes zero? 🤔 |
Thank you for the details, I'll try to investigate it more on eclipseide-jdtls end and will come back later with some more details. In the meantime, the new behavior we see is not really a regression, it's a different bug of the same serverity; so it would be fine if this PR gets merged. |
...dt.ls.core/src/org/eclipse/jdt/ls/core/internal/contentassist/SnippetCompletionProposal.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sheng Chen <sheche@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The remaining -and unrelated- issue I see with completion of snippets in eclipseide-jdtls is now tracked in #2627 |
the preference 'java.completion.lazyResolveTextEdit.enabled' is set
to true.
'textDocument/completion'.
requires redhat-developer/vscode-java#3072
fix #2584