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.

Restore erronously removed APIs

Mikayla118a3461a7a6
diff --git a/crates/gpui/src/keymap/matcher.rs b/crates/gpui/src/keymap/matcher.rs
index 9f8759b2a92..5bf21073219 100644
--- a/crates/gpui/src/keymap/matcher.rs
+++ b/crates/gpui/src/keymap/matcher.rs
@@ -96,6 +96,21 @@ pub enum KeyMatch {
Some(Vec<Box<dyn Action>>),
}
+impl KeyMatch {
+ /// Returns true if the match is complete.
+ pub fn is_some(&self) -> bool {
+ matches!(self, KeyMatch::Some(_))
+ }
+
+ /// Get the matches if the match is complete.
+ pub fn matches(self) -> Option<Vec<Box<dyn Action>>> {
+ match self {
+ KeyMatch::Some(matches) => Some(matches),
+ _ => None,
+ }
+ }
+}
+
impl PartialEq for KeyMatch {
fn eq(&self, other: &Self) -> bool {
match (self, other) {