Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Do not allow cmd+click in invalid inlay context

Kirill Bulatov81e70905bb20
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 684f92a96a8..62f4c8c8065 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -2755,7 +2755,7 @@ impl PointForPosition {
}
}
- fn as_valid(&self) -> Option<DisplayPoint> {
+ pub fn as_valid(&self) -> Option<DisplayPoint> {
if self.previous_valid == self.exact_unclipped && self.next_valid == self.exact_unclipped {
Some(self.previous_valid)
} else {
diff --git a/crates/editor/src/link_go_to_definition.rs b/crates/editor/src/link_go_to_definition.rs
index 909c07880b7..9ca39f9b307 100644
--- a/crates/editor/src/link_go_to_definition.rs
+++ b/crates/editor/src/link_go_to_definition.rs
@@ -596,9 +596,11 @@ fn go_to_fetched_definition_of_kind(
cx,
);
- match kind {
- LinkDefinitionKind::Symbol => editor.go_to_definition(&Default::default(), cx),
- LinkDefinitionKind::Type => editor.go_to_type_definition(&Default::default(), cx),
+ if point.as_valid().is_some() {
+ match kind {
+ LinkDefinitionKind::Symbol => editor.go_to_definition(&Default::default(), cx),
+ LinkDefinitionKind::Type => editor.go_to_type_definition(&Default::default(), cx),
+ }
}
}
}