Add a way to control go to definition fallback (#27426)

Follow-up of https://github.com/zed-industries/zed/pull/9243 and
https://github.com/zed-industries/zed/pull/16512

Release Notes:

- Added a way to control go to definition fallback
This commit is contained in:
Kirill Bulatov
2025-03-25 22:13:35 +00:00
committed by GitHub
parent 8c8f50d916
commit 30f7e896cf
5 changed files with 107 additions and 7 deletions
+7 -2
View File
@@ -1,5 +1,5 @@
use crate::{
editor_settings::MultiCursorModifier,
editor_settings::{GoToDefinitionFallback, MultiCursorModifier},
hover_popover::{self, InlayHover},
scroll::ScrollAmount,
Anchor, Editor, EditorSettings, EditorSnapshot, FindAllReferences, GoToDefinition,
@@ -174,7 +174,12 @@ impl Editor {
if definition_revealed == Navigated::Yes {
return None;
}
editor.find_all_references(&FindAllReferences, window, cx)
match EditorSettings::get_global(cx).go_to_definition_fallback {
GoToDefinitionFallback::None => None,
GoToDefinitionFallback::FindAllReferences => {
editor.find_all_references(&FindAllReferences, window, cx)
}
}
})
.ok()
.flatten();