Fix cmd+click find all references fallback not working in Vim mode (#10684)
Exclude go-to-definition links returned by LSP that points to the current cursor position. This fixes #10392 . Related PR #9243 . The previous implementation first performs go-to-definition, and if the selected text covers the clicked position, it figures out that it is already clicking on a definition, and should instead look for references. However, the selected range does not necessarily cover the clicked position after clicking on a definition, as in VIM mode. After the PR, if cmd+click on definitions, the definition links would be an empty list, so no go-to-definition is performed, and find-all-references is performed instead. Release Notes: - Fixed #10392 , now `cmd+click`ing to find all references works in vim mode.
This commit is contained in:
parent
11bcfea6d2
commit
21022f1644
2 changed files with 53 additions and 67 deletions
|
@ -7745,7 +7745,13 @@ impl Editor {
|
|||
.update(&mut cx, |editor, cx| {
|
||||
editor.navigate_to_hover_links(
|
||||
Some(kind),
|
||||
definitions.into_iter().map(HoverLink::Text).collect(),
|
||||
definitions
|
||||
.into_iter()
|
||||
.filter(|location| {
|
||||
hover_links::exclude_link_to_position(&buffer, &head, location, cx)
|
||||
})
|
||||
.map(HoverLink::Text)
|
||||
.collect::<Vec<_>>(),
|
||||
split,
|
||||
cx,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue