-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Snippets insert literal text #6259
Comments
Do you have the log line for the completion response? I'm pretty sure that the text is the snippet placeholders and you should be able to hit Enter to dismiss/delete them |
yeah to expand on this: if you press |
Ah, you're correct. |
Ah I see there is a bug here in a way: For non-snippet completions you can hit tab and keep typing to:
Case 1 actually can't work for snippets (a snippet can't be a prefix of a different completion). You are essentially using case 2. Case 2 isn't really accepting a completion for real but just keeping the preview we showed and keep editing. It's actually different to accpeting the completion in other ways too. The LS can send additional edits together with a completion that are supposed to be applied when a completion is accepted. This only happens on enter aswell. So that means you are also missing these additional edits. These edits are often used for autoimports or similar features. In the longterm we want to use virtual text for placeholders (which would be automatically removed). I think we do actually want to activate/show these when a completion is selected with tab. I think we could then also apply the additional edits in that case (it's what vscode does too). This is likely some effort and a bit further down the line altough we have all completions in helix now. Something slightly offtopic I noticed while looking into this: RA currently abuses the additional edits to make postfix completions work. For example with RA if you place the cursor after let foo = data. and select the let foo = data.Box::new(data) Only once you confirm with let foo = Box::new(data); Even worse this messes up multicursors, because this additional edit only get applied once, so for secondary cursors Precisely for this reasons such uses of additional edits are advised against by the LSP standard:
I wonder why RA does it does way, hopefully patching this won't be too hard |
For functions with more than 1 argument,
|
This is on purpose and just part of the snippet. Vscode does the same. Just that vscode allows you to automatically jump between arguments (tabstops) which is currently not implemented |
Given:
You get
Typing inserts text after
n
, but thesize_type n
is left in place.This started as of d2af31b and is still present on
master
as of today.https://asciinema.org/a/UidjhxmHTQmLsUHO2IKPawgwT
The text was updated successfully, but these errors were encountered: