helix icon indicating copy to clipboard operation
helix copied to clipboard

Remove duplicates from the picker

Open ath3 opened this issue 3 years ago • 5 comments

Trying to find references for example in goto_reference in commands.rs brings up a lot of duplicate matches. This change removes the duplicates from lsp goto_* commands.

Before: picker_old

After: picker_new

ath3 avatar Oct 04 '22 02:10 ath3

How can I preview multiple references to the same symbol in a specific file with these changes? I often use go_to_reference to check usage of specific method/function, I wonder how can I do that without having all the individual references from single file in the picker.

matoous avatar Oct 04 '22 08:10 matoous

That works, even if the same symbol is on the same line multiple times, because the position returned from lsp is different for them. For example line Some(highlights) if !highlights.is_empty() => highlights, will be listed three times if i make goto_reference on highlights.

ath3 avatar Oct 04 '22 08:10 ath3

How can I preview multiple references to the same symbol in a specific file with these changes?

This behavior is unchanged. It's only merging completely identical references: same range of characters in the same file. Separate references in the same file will continue working like normal

A-Walrus avatar Oct 04 '22 09:10 A-Walrus

Personally, I think the duplicates should be fixed on the language server side, instead of working around this in helix.

archseer avatar Oct 04 '22 20:10 archseer

Ah I didn't know someone else had a PR in progress.

Personally, I think the duplicates should be fixed on the language server side, instead of working around this in helix.

:eyes: at rust-analyzer's 1000+ open issues
Ideally, yes. But a workaround like this or #4252 would be appreciated in the meantime.

abseee avatar Oct 13 '22 18:10 abseee

I think we can close this now since RA merged an upstream fix for this last year: https://github.com/rust-lang/rust-analyzer/pull/13571

pascalkuthe avatar Jul 26 '23 13:07 pascalkuthe