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
Don't replace next token on autocomplete #3365
Comments
We agree that this is annoying, and doesn't happen in other LSP clients so may not be directly related to gopls. Even if we're not smart enough to include the variable as an argument, we should not be deleting existing text. |
VSCode has this setting:
However, it seems that each extension needs to opt into supporting it, and I assume vscode-go hasn't? Also, I don't believe I had this issue in the past, but my memory might be playing tricks on me here. There is a chance this is a regression? I'd appreciate this being prioritized, or if not, some pointers to where in the codebase this may be happening. I can spend some time researching this and sending a PR. |
@findleyr Is this working in other editors? Repro:
|
I think this needs golang/go#61215. In this specific example, triggering completion after typing
gopls returns completion items, whose text edit ranges are always the whole
This old style TextEdit is translated to a VS Code CompletionItem with a single |
Change https://go.dev/cl/585275 mentions this issue: |
Any progress on this issue? |
Is your feature request related to a problem? Please describe.
Let's say the line currently is:
someLongVariableName.Name()
When I now place the cursor before
someLongVariableName
, and typestrings.HasP
+ [enter], the line becomes:strings.HasPrefix().Name()
I think it would be better if it would become one of:
strings.HasPrefix(someLongVariableName.Name()
(missing closing bracket)strings.HasPrefix(someLongVariableName.Name())
(with closing bracket)strings.HasPrefixsomeLongVariableName.Name()
(cursor being in front ofsomeLongVariableName
)Describe the solution you'd like
If this isn't a bug (it sort of feels like one, though), can we get a setting with which we can control this behavior?
Thank you!
The text was updated successfully, but these errors were encountered: