Improve Bash syntax highlighting (#25324)
Release Notes: - Improved Bash syntax highlighting | Zed 0.174.6 | With this PR | | --- | --- | |  |  | - `string`: `string` - `variable`: `property` -> `variable` - `number`: `number` - `regex`: `string.regex` - `>&`, `>&-`, `:`, `//`, `/`, `%`, `%%`, `#`, `##`, `=`, `==`: `operator` - `-lt`, `-le`, `-gt`, `-ge`, `-eq`, `-ne`, `-z`, `-n`: `keyword.operator` - `;`: `punctuation.delimiter` - `(`, `)`, `{`, `}`, `[`, `]`: `punctuation.bracket` - `$`, `${ }`, `$( )`: `punctuation.special`, as defined in other languages ```bash variable=I\ like\ Zed function my_function() { echo "Hello world, ${variable//regex/string}" > file } if [ $(uid) -lt 600 ]; then my_function; cat file | grep hello >&3 fi ```
This commit is contained in:
parent
a4ade37a56
commit
d0a0303428
1 changed files with 47 additions and 5 deletions
|
@ -4,11 +4,10 @@
|
||||||
(heredoc_body)
|
(heredoc_body)
|
||||||
(heredoc_start)
|
(heredoc_start)
|
||||||
(ansi_c_string)
|
(ansi_c_string)
|
||||||
|
(word)
|
||||||
] @string
|
] @string
|
||||||
|
|
||||||
(command_name) @function
|
(variable_name) @variable
|
||||||
|
|
||||||
(variable_name) @property
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"case"
|
"case"
|
||||||
|
@ -35,24 +34,67 @@
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
(function_definition name: (word) @function)
|
(function_definition name: (word) @function)
|
||||||
|
(command_name (word) @function)
|
||||||
|
|
||||||
(file_descriptor) @number
|
[
|
||||||
|
(file_descriptor)
|
||||||
|
(number)
|
||||||
|
] @number
|
||||||
|
|
||||||
|
(regex) @string.regex
|
||||||
|
|
||||||
[
|
[
|
||||||
(command_substitution)
|
(command_substitution)
|
||||||
(process_substitution)
|
(process_substitution)
|
||||||
(expansion)
|
(expansion)
|
||||||
]@embedded
|
] @embedded
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"$"
|
"$"
|
||||||
"&&"
|
"&&"
|
||||||
">"
|
">"
|
||||||
">>"
|
">>"
|
||||||
|
">&"
|
||||||
|
">&-"
|
||||||
"<"
|
"<"
|
||||||
"|"
|
"|"
|
||||||
|
":"
|
||||||
|
"//"
|
||||||
|
"/"
|
||||||
|
"%"
|
||||||
|
"%%"
|
||||||
|
"#"
|
||||||
|
"##"
|
||||||
|
"="
|
||||||
|
"=="
|
||||||
] @operator
|
] @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)
|
(command (_) @constant)
|
||||||
(#match? @constant "^-")
|
(#match? @constant "^-")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue