From a87370b1119295438e652a36ca4b18fcb8ba6932 Mon Sep 17 00:00:00 2001 From: Ryan Westlund Date: Tue, 11 Aug 2020 21:39:57 -0400 Subject: [PATCH 1/2] Improve Rust syntax highlighting (#1820) --- runtime/syntax/rust.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/syntax/rust.yaml b/runtime/syntax/rust.yaml index 9bc19017..f24bcfb9 100644 --- a/runtime/syntax/rust.yaml +++ b/runtime/syntax/rust.yaml @@ -7,15 +7,19 @@ rules: # function definition - identifier: "fn [a-z0-9_]+" # Reserved words - - statement: "\\b(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b" + - statement: "\\b(abstract|alignof|as|become|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b" # macros - special: "[a-z_]+!" # Constants - - constant: "[A-Z][A-Z_]+" + - constant: "\\b[A-Z][A-Z_0-9]+\\b" # Numbers - constant.number: "\\b[0-9]+\\b" + # Booleans + - constant: "\\b(true|false)\\b" # Traits/Enums/Structs/Types/etc. - - type: "[A-Z][a-z]+" + - type: "\\b[A-Z]+[a-zA-Z_0-9]*[a-z]+[a-zA-Z_0-9]*\\b" + # Builtin types that start with lowercase. + - type: "\\b(bool|str|isize|usize|((i|u)(8|16|32|64))|f32|f64)\\b" - constant.string: start: "\"" From 5cb618c466ae867e7b691e82c7bc64ea7259cf03 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 11 Aug 2020 22:18:10 -0400 Subject: [PATCH 2/2] Improve showkey command --- internal/action/command.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/action/command.go b/internal/action/command.go index f3f5db48..63492471 100644 --- a/internal/action/command.go +++ b/internal/action/command.go @@ -641,7 +641,12 @@ func (h *BufPane) ShowKeyCmd(args []string) { return } - if action, ok := config.Bindings[args[0]]; ok { + event, err := findEvent(args[0]) + if err != nil { + InfoBar.Error(err) + return + } + if action, ok := config.Bindings[event.Name()]; ok { InfoBar.Message(action) } else { InfoBar.Message(args[0], " has no binding")