From f0c6a6ad182d77411db4a4ff0674ff22dc9c86df Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 22 Apr 2022 12:16:49 -0700 Subject: [PATCH] Highlight punctuation uniformly in all supported languages Co-authored-by: Keith Simmons --- crates/zed/src/languages/c/highlights.scm | 11 +++++++++- .../src/languages/javascript/highlights.scm | 1 + crates/zed/src/languages/json/highlights.scm | 9 ++++++++- crates/zed/src/languages/rust/highlights.scm | 14 +++++++++++++ crates/zed/src/languages/toml/highlights.scm | 20 +++++++++++-------- .../src/languages/typescript/highlights.scm | 1 + 6 files changed, 46 insertions(+), 10 deletions(-) diff --git a/crates/zed/src/languages/c/highlights.scm b/crates/zed/src/languages/c/highlights.scm index 9f2dabff17..4a9c7bf2ea 100644 --- a/crates/zed/src/languages/c/highlights.scm +++ b/crates/zed/src/languages/c/highlights.scm @@ -56,7 +56,16 @@ [ "." ";" -] @delimiter +] @punctuation.delimiter + +[ + "{" + "}" + "(" + ")" + "[" + "]" +] @punctuation.bracket [ (string_literal) diff --git a/crates/zed/src/languages/javascript/highlights.scm b/crates/zed/src/languages/javascript/highlights.scm index cb4e82b33d..d3921cdbc8 100644 --- a/crates/zed/src/languages/javascript/highlights.scm +++ b/crates/zed/src/languages/javascript/highlights.scm @@ -86,6 +86,7 @@ "?." "." "," + ":" ] @punctuation.delimiter [ diff --git a/crates/zed/src/languages/json/highlights.scm b/crates/zed/src/languages/json/highlights.scm index 9754465166..b5c64e9634 100644 --- a/crates/zed/src/languages/json/highlights.scm +++ b/crates/zed/src/languages/json/highlights.scm @@ -11,4 +11,11 @@ (true) (false) (null) -] @constant \ No newline at end of file +] @constant + +[ + "{" + "}" + "[" + "]" +] @punctuation.bracket \ No newline at end of file diff --git a/crates/zed/src/languages/rust/highlights.scm b/crates/zed/src/languages/rust/highlights.scm index 116be75842..d4f571dd52 100644 --- a/crates/zed/src/languages/rust/highlights.scm +++ b/crates/zed/src/languages/rust/highlights.scm @@ -34,6 +34,20 @@ ((identifier) @constant (#match? @constant "^[A-Z][A-Z\\d_]+$")) +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +(_ + . + "<" @punctuation.bracket + ">" @punctuation.bracket) + [ "as" "async" diff --git a/crates/zed/src/languages/toml/highlights.scm b/crates/zed/src/languages/toml/highlights.scm index 9f43b6aa6f..04d83b5459 100644 --- a/crates/zed/src/languages/toml/highlights.scm +++ b/crates/zed/src/languages/toml/highlights.scm @@ -20,14 +20,18 @@ ; Punctuation ;------------ -"." @punctuation.delimiter -"," @punctuation.delimiter +[ + "." + "," +] @punctuation.delimiter "=" @operator -"[" @punctuation.bracket -"]" @punctuation.bracket -"[[" @punctuation.bracket -"]]" @punctuation.bracket -"{" @punctuation.bracket -"}" @punctuation.bracket \ No newline at end of file +[ + "[" + "]" + "[[" + "]]" + "{" + "}" +] @punctuation.bracket diff --git a/crates/zed/src/languages/typescript/highlights.scm b/crates/zed/src/languages/typescript/highlights.scm index cb4e82b33d..d3921cdbc8 100644 --- a/crates/zed/src/languages/typescript/highlights.scm +++ b/crates/zed/src/languages/typescript/highlights.scm @@ -86,6 +86,7 @@ "?." "." "," + ":" ] @punctuation.delimiter [