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.

Improve Bash syntax highlighting (#25324)

chbkd0a0303428be
diff --git a/crates/languages/src/bash/highlights.scm b/crates/languages/src/bash/highlights.scm
index 5cb5dad6a00..a8ae81058a1 100644
--- a/crates/languages/src/bash/highlights.scm
+++ b/crates/languages/src/bash/highlights.scm
@@ -4,11 +4,10 @@
(heredoc_body)
(heredoc_start)
(ansi_c_string)
+ (word)
] @string
-(command_name) @function
-
-(variable_name) @property
+(variable_name) @variable
[
"case"
@@ -35,24 +34,67 @@
(comment) @comment
(function_definition name: (word) @function)
+(command_name (word) @function)
+
+[
+ (file_descriptor)
+ (number)
+] @number
-(file_descriptor) @number
+(regex) @string.regex
[
(command_substitution)
(process_substitution)
(expansion)
-]@embedded
+] @embedded
+
[
"$"
"&&"
">"
">>"
+ ">&"
+ ">&-"
"<"
"|"
+ ":"
+ "//"
+ "/"
+ "%"
+ "%%"
+ "#"
+ "##"
+ "="
+ "=="
] @operator
+(test_operator) @keyword.operator
+
+[
+ ";"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+(simple_expansion
+ "$" @punctuation.special)
+(expansion
+ "${" @punctuation.special
+ "}" @punctuation.special) @embedded
+
+(command_substitution
+ "$(" @punctuation.special
+ ")" @punctuation.special)
+
(
(command (_) @constant)
(#match? @constant "^-")