2

fix: set the right postfix snippets competion source range by mrnossiom · Pull R...

 2 weeks ago
source link: https://github.com/rust-lang/rust-analyzer/pull/17000
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

fix: set the right postfix snippets competion source range #17000

Conversation

Contributor

Hi 👋,

Changed the completion item source_range to match the replaced text. Though in VS Code it may not be disturbing because the snippet is previewed in a box, but in Helix editor, it's previewed by applying the main text edit.

Before :
image

After :

image

Thanks

rustbot

added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label

Apr 2, 2024

Member

Thanks!
@bors r+

Collaborator

📌 Commit c5686c8 has been approved by Veykril

It is now in the queue for this repository.

Collaborator

⌛ Testing commit c5686c8 with merge 5b08b17...

Collaborator

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 5b08b17 to master...

bors

merged commit 5b08b17 into

rust-lang:master

Apr 3, 2024

11 checks passed

Contributor

thanks for working on this! I just wanted to say that this doesn't just fix the preview (which is just a visual thing) but also multicursor completions.

Additional text edits can't be mapped to multiple cursor (since they aren't associated with the cursor. The spec actually considers this use case. You don't want to repeat imports for each cursor for example).

I see that RA does this as a workaround for LSP only allowing a single edit to each completion item. I think that generally makes sense for associated edits like imports but I can't think of a practical case where multiple edits would be associated with each cursor. I suspect the RA completion edit could be brought closer to the lsp completion edit and avoid impedance mismatches like this bug

mrnossiom reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

None yet

5 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK