-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
LSP completions only affect first selection in multiple selection #2016
Comments
I've had this exact same issue right now coding with Go. |
@crdpa I just ran into it again myself. This is something that you can easily find yourself wanting to do quite often. It’s one of those things that I realise has made me quite tense when using Helix with multiple selections as I’m not entirely sure when it’s going to garble what I’m doing (the other is the auto completion of quotes not acting intelligently #2400) :) |
@aral would you mind moving the workaround from the FAQ to this issue? I think that workaround fits better on this issue than the faq |
@the-mikedavis Sure. I just thought it might help folks if it was more visible as it’s such a common thing. |
Use LSP autocomplete with multiple selections (temporary workaround)Until the bug with LSP autocomplete with multiple selections is fixed, you can use this workaround: import assert from 'assert'
import test from 'tape'
test ('stuff', t => {
assert(x)
assert(y)
assert(z)
}) To move from basic asserts to tape’s asserts:
import assert from 'assert'
import test from 'tape'
test ('stuff', t => {
t.true(x)
t.true(y)
t.true(z)
}) Once the bug is fixed you will simply be able to select all three asserts and replace them all using auto-complete. |
PS. Above copy/pasted from the Wiki which uses asciidoc. Not sure why when markdown is used everywhere else. Don’t have time to look into converting it now. |
Yeah we should probably convert the faq to markdown at some point to be consistent. I'll give the comment an edit and see if I can fix the display |
I've made an attempt at fixing this here: https://github.com/mtoohey31/helix/tree/feat/multi-selection-autocomplete. It seems to work, but I'm pretty sure I've made some unsafe assuptions about what the different offsets might be, so I don't think it's ready for a PR yet. Maybe someone who's more familiar with this code can use my attempt as a starting point. |
just in case it's helpful here's an asciinema of the issue → https://asciinema.org/a/523860 |
The FAQ says "Note: If you use LSP autocomplete, only the first match will be auto-completed. If you want to auto-complete all matches, you currently have to use this workaround." Now that this issue is closed, can the FAQ can be updated? |
Yep, I just pushed a change to remove that note 👍 |
Summary
If you have multiple selections, language completion only affects the first one.
Reproduction Steps
Create a simple JS file and ensure JS LSP is installed.
foo
return (select bothfoo
instances)What should happen
Both
foo
instances should autocomplete tobe
:What actually happens
Only the first
foo
autocompletes tobe
:Helix log
n/a
Platform
Linux (elementary OS 6; based on Ubuntu)
Terminal Emulator
io.elementary.t
Helix Version
helix 22.05-dev (2d4f94e)
The text was updated successfully, but these errors were encountered: