Open polo7 opened 4 months ago
Hey, thanks for the report. I believe this is not a bug (kinda); gopls doesn't support insert and replace edits it seems. See #9634 and #10411. TL;DR: yes, that behavior is wrong, but it can be solved within the language server itself.
Whoops, I take that back. It seems to support it, based on the sources alone: https://github.com/golang/tools/blob/03419175878954be2b792c470f49819e7e0f616e/gopls/internal/protocol/tsinsertreplaceedit.go#L25
Ok, yeah, sorry, I didn't read the issue thoroughly enough. gopls does support replacement text edits, but it is funky at times, as you've spotted. The same issue is reproducible with VScode as well. I'd say this is not an issue with Zed, but with the language server itself.
Let's keep this issue open just in case anything changes on gopls side.
Potentially related: https://go-review.googlesource.com/c/tools/+/585275
I also observed this same behavior on Clojure files.
https://github.com/user-attachments/assets/2baecbad-da91-422f-9f78-7106a7f00fbb
Check for existing issues
Describe the bug / provide steps to reproduce it
When you start typing a name of variable and use autocomplete then the result will consist of "typed-part" + "full name added by autocomplete".
Example: var name I type "na" and get [name] in the hint -> choose this offer and get: naname
This time the bug appears only for 2nd, 3d and so on variables in a row.
https://github.com/zed-industries/zed/assets/40734771/5e4766c1-30b3-47fd-82d5-3fb31d525eb4
But sometimes it appears even with the first variable in a row (I guess there is something with parsing of unfinished lines)
https://github.com/zed-industries/zed/assets/40734771/0762efa6-4d6a-4bb6-a3ce-8cd5bd758680
Environment
Zed: v0.138.6 (Zed) OS: macOS 12.7.3 Memory: 8 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.No response