Files
zed/crates/languages/src/bash/highlights.scm
T
Cole McAnelly 684d562deb languages: Separate control flow keywords for Shell Scripts (#46722)
Part of https://github.com/zed-industries/zed/issues/9461. Similar PRs:

- https://github.com/zed-industries/zed/pull/39683
- https://github.com/zed-industries/zed/pull/39801


## Release Notes:

- Added the ability to separately highlight control flow keywords for
Shell Scripts for users and theme authors via the `keyword.control`
syntax property.

## Screenshots

| **Before** | **After** |
|:--:|:--:|
| <img width="719" height="860" alt="image"
src="https://github.com/user-attachments/assets/1e509e7b-a197-4fb0-a5da-bd3669b6bcd6"
/> | <img width="718" height="855" alt="image"
src="https://github.com/user-attachments/assets/9c5e253d-bfd6-4fe7-9e30-95af1b260fdf"
/> |
2026-01-14 16:52:39 +00:00

107 lines
1.1 KiB
Scheme

[
(string)
(raw_string)
(heredoc_body)
(heredoc_start)
(heredoc_end)
(ansi_c_string)
(word)
] @string
(variable_name) @variable
[
"export"
"function"
"unset"
"local"
"declare"
] @keyword
[
"case"
"do"
"done"
"elif"
"else"
"esac"
"fi"
"for"
"if"
"in"
"select"
"then"
"until"
"while"
] @keyword.control
(comment) @comment
(function_definition name: (word) @function)
(command_name (word) @function)
[
(file_descriptor)
(number)
] @number
(regex) @string.regex
[
(command_substitution)
(process_substitution)
(expansion)
] @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 "^-")
)