-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Postfix snippets no longer work in vscode #17036
Comments
me too |
Possibly related to #17000. That's strange since it works fine on emacs (eglot) 🤔 |
Magic completion dosen't show up in the completion list too after upgrading to a newer version. |
@rustbot claim I've identified the problem. For illustration, let's use the following example:
Before #17000, r-a would send But in VS Code, the starting position for Currently, I've thought of several solutions:
I would prefer the second solution. |
Postfix snippets seems to be broken in Neovim as well. Working fine in 2024-04-01, not showing up in 2024-04-08 |
Helix fully support additionalTextEdits. We just dont preview them since we expect them to not be associated with the cursor. Quote from the LSP spec:
So we only apply additionalTextEditd when accepting a completion. Qhile the lossy in preview is a bit annoying it's not that big of a deal. The real problem is that these kinds of edits do not work with multicursor completions. You can map the main completion edit to each cursor (by computing relative positions to the curosr). But you can't do that with These edits are perfectly valid according to the LSP spec. The spec says the completion position must be contained within the edit but not that it must start exactly at the cursor:
The reason this gets filtered is not that vacode filters out all edits that precede the cursor position. The reason is that vscode uses the replace range for filtering so to take the example from above if the edit replaces The right way to fix this issue in a spec compliant manner is to adjust the filter text of these completions to include the prefix they are replacing |
So, we should be able to change the replace range here if we also fix up the filter text used for postfix completions. Then VSCode should be happy as well? |
Exactly, sorry my comment wasn't perfectly clear. I didn't have my first coffee yet. In fact RA already does exactly that for other edits I think (there are some edits which replace the word the cursor is in. These also replace text before the curosr and they work in VSCode because they set the filtertext correctly. I was planning to do a PR that implements what I describe once I have some freetime. That should fix the problems we are seeing in helix while also making sure that the completions don't get filtered out in VSCode |
Great, thanks for that :) (fwiw in r-a the filter field is called |
@pascalkuthe, thanks for your correction! I followed your description to add both prefix and postfix to the |
sure go ahead I just want to see this fixed :) |
Better inline preview for postfix completion Better inline preview for postfix completion, a proper implementation of c5686c8. Here editors may filter completion item with the text within `delete_range`, so we need to include the `receiver text` in the `lookup` (aka `FilterText` in LSP spec) for editors to find the completion item. (See #17036 (comment), Thanks to [pascalkuthe](https://github.com/pascalkuthe))
Revert "fix: set the right postfix snippets competion source range" This reverts commit c5686c8. Fix rust-lang#17036. See rust-lang/rust-analyzer#17036 (comment)
Better inline preview for postfix completion Better inline preview for postfix completion, a proper implementation of c5686c8. Here editors may filter completion item with the text within `delete_range`, so we need to include the `receiver text` in the `lookup` (aka `FilterText` in LSP spec) for editors to find the completion item. (See rust-lang/rust-analyzer#17036 (comment), Thanks to [pascalkuthe](https://github.com/pascalkuthe))
Sorry there, I've not received notifications about this. Glad you found another way around. |
I believe that both fixes for this got reverted because of issues with VSCode and other editors. Still, it would be great if we had proper visualization on Helix.
If this was the spec compliant way, wouldn't it be possible to take a look at VS Code src? I can try. |
rust-analyzer version: 0.4.1909-standalone
editor or extension: VSCode with extension v0.4.1909 (pre-release)
Postfix snippets stopped working after I've updated vscode extension.
After downgrading a few times I found that the last version that has postfix snippets working is v0.4.1908. Upgrading it to v0.4.1909 breaks them.
v0.4.1908
v0.4.1909
The text was updated successfully, but these errors were encountered: