-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: snippets do not replace triggering preamble #59508
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
Comments
Unfortunately I cannot reproduce the issue with VS Code. |
@hyangah Here you go. The conversation looks sane, so it may well be that the Sublime LSP client is doing something wrong.
|
Thanks for sharing the trace. This is the part that may look relevant.
This is a similar sequence captured in vscode.
In both cases, the editor sent the completion request when on position (2,7). Gopls returned the completion item with start range (2,5). However, there are some differences.
Some hypothesis:
|
I couldn't repro in Emacs via lsp-mode. |
The insert range from gopls is definitely wrong - it should be overwriting the prefix. The initial range computed by gopls in this case is the start and end of the *ast.Ident being completed (i.e. "Te"). I haven't spotted any conditional logic yet to explain the discrepancy. Can you share the entire contents of a test file that reproduces it? |
<tab> at the final position in the file. |
Hi @kortschak , Could you test if the problem exists on gopls master? Edit: see findleyr response on how. |
Thanks for finding that, @vikblom. Yes, I think this is a dupe of https://go.dev/issue/57480.
This is not the correct way to install gopls@master (and I'd be surprised if it worked), because it doesn't honor the replace directive. To install gopls@master, you should check out x/tools, cd gopls, and |
Thanks, yes that has it fixed. |
gopls version
go env
What did you do?
In a test file, start a snippet suggestion with "func Te" and accept the completion "TestXxx(t *testing.T)" and you'll end up with
What did you expect to see?
What did you see instead?
Editor and settings
Sublime Text
Client: https://github.com/sublimelsp/LSP
Logs
The text was updated successfully, but these errors were encountered: