-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Snippet completions from JDTLS not inserting text properly #21603
Comments
I think we're actually doing the correct thing here; the completion you've listed has both
I'd suggest to file an issue with the language server. Feel free to reopen this issue if anything. |
Hello again @osiewicz, I've spoken with a JDTLS dev here and we think this is in fact the fault of Zed. We noticed a discrepancy between the completion that Zed receives and the completion that Zed asks to autocomplete: // Send:
{"jsonrpc":"2.0","id":38,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///Users/valentinebriese/Developer/SwerveDrive2025/src/main/java/frc/robot/subsystems/Test.java"},"position":{"line":0,"character":3},"context":{"triggerKind":1}}}
// Receive:
{"jsonrpc":"2.0","id":38,"result":{"isIncomplete":false,"items":[{"label":"class","kind":15,"documentation":"package frc.robot.subsystems;\n\npublic class Test {\n\n\t\n}","sortText":"999999212","filterText":"class","insertText":"package frc.robot.subsystems;\n\npublic class Test {\n\n\t${0}\n}","insertTextMode":2,"textEditText":"package frc.robot.subsystems;\n\npublic class Test {\n\n\t${0}\n}"},{"label":"class","kind":14,"sortText":"999999213","filterText":"class","textEditText":"class","command":{"title":"","command":"java.completion.onDidSelect","arguments":["10","0"]},"data":{"pid":"0","rid":"10"}}],"itemDefaults":{"editRange":{"insert":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"replace":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}}},"insertTextFormat":2,"data":{"completionKinds":[3]}}}}
// Send:
{"jsonrpc":"2.0","id":39,"method":"completionItem/resolve","params":{"label":"class","kind":15,"documentation":"package frc.robot.subsystems;\n\npublic class Test {\n\n\t\n}","sortText":"999999212","filterText":"class","insertText":"package frc.robot.subsystems;\n\npublic class Test {\n\n\t${0}\n}","insertTextFormat":2,"insertTextMode":2,"textEdit":{"newText":"class","insert":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"replace":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}}},"data":{"completionKinds":[3]}}}
// Receive:
{"jsonrpc":"2.0","id":39,"result":{"label":"class","kind":15,"documentation":"package frc.robot.subsystems;\n\npublic class Test {\n\n\t\n}","sortText":"999999212","filterText":"class","insertText":"package frc.robot.subsystems;\n\npublic class Test {\n\n\t${0}\n}","insertTextFormat":2,"insertTextMode":2,"textEdit":{"newText":"class","insert":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"replace":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}}}}} This comment may be particularly informative. I believe this means this issue should be reopened, which I am unable to do myself ^^' |
Oh, then it's #21277 |
Looks like it, sorry for making a duplicate issue then |
Check for existing issues
Describe the bug / provide steps to reproduce it
When attempting to autocomplete a snippet completion with the Zed Java extension (which uses Eclipse JDT Language Server, aka. JDTLS), Zed inserts the name of the snippet instead of the snippet's
insertText
.For example, if I autocomplete
class
in a file calledDriveSubsystem.java
, Zed just inserts the textclass
when I would've expected:Here are the LSP RPC logs around the time of autocompleting:
Environment
Zed: v0.165.2 (Zed Preview)
OS: macOS 15.2.0
Memory: 8 GiB
Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log
The text was updated successfully, but these errors were encountered: