mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
feat(bash): improve highlights
This commit is contained in:
parent
99eef501a3
commit
1ff7985a74
3 changed files with 50 additions and 38 deletions
|
|
@ -15,7 +15,7 @@
|
||||||
"revision": "244426241376b08d9531616290d657106ec8f7ff"
|
"revision": "244426241376b08d9531616290d657106ec8f7ff"
|
||||||
},
|
},
|
||||||
"bash": {
|
"bash": {
|
||||||
"revision": "42ab5ca0e6bb7130c397c7ca10440fd5cfc2d564"
|
"revision": "aaae047b927bcbd04ddbb07b32b555831c482c1a"
|
||||||
},
|
},
|
||||||
"bass": {
|
"bass": {
|
||||||
"revision": "27f110dfe79620993f5493ffa0d0f2fe12d250ed"
|
"revision": "27f110dfe79620993f5493ffa0d0f2fe12d250ed"
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,21 @@
|
||||||
(simple_expansion) @none
|
|
||||||
(expansion
|
|
||||||
"${" @punctuation.special
|
|
||||||
"}" @punctuation.special) @none
|
|
||||||
[
|
[
|
||||||
"("
|
"(" ")"
|
||||||
")"
|
"{" "}"
|
||||||
"(("
|
"[" "]"
|
||||||
"))"
|
"[[" "]]"
|
||||||
"{"
|
] @punctuation.bracket
|
||||||
"}"
|
|
||||||
"["
|
|
||||||
"]"
|
|
||||||
"[["
|
|
||||||
"]]"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
[
|
[
|
||||||
";"
|
";"
|
||||||
";;"
|
";;"
|
||||||
(heredoc_start)
|
"&"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
|
||||||
"$"
|
|
||||||
] @punctuation.special
|
|
||||||
|
|
||||||
[
|
[
|
||||||
">"
|
">"
|
||||||
">>"
|
">>"
|
||||||
"<"
|
"<"
|
||||||
"<<"
|
"<<"
|
||||||
"&"
|
|
||||||
"&&"
|
"&&"
|
||||||
"|"
|
"|"
|
||||||
"||"
|
"||"
|
||||||
|
|
@ -38,7 +23,7 @@
|
||||||
"=~"
|
"=~"
|
||||||
"=="
|
"=="
|
||||||
"!="
|
"!="
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
; Do *not* spell check strings since they typically have some sort of
|
; Do *not* spell check strings since they typically have some sort of
|
||||||
; interpolation in them, or, are typically used for things like filenames, URLs,
|
; interpolation in them, or, are typically used for things like filenames, URLs,
|
||||||
|
|
@ -48,8 +33,14 @@
|
||||||
(raw_string)
|
(raw_string)
|
||||||
(ansi_c_string)
|
(ansi_c_string)
|
||||||
(heredoc_body)
|
(heredoc_body)
|
||||||
|
(simple_heredoc_body)
|
||||||
] @string
|
] @string
|
||||||
|
|
||||||
|
[
|
||||||
|
(heredoc_start)
|
||||||
|
(heredoc_end)
|
||||||
|
] @label
|
||||||
|
|
||||||
(variable_assignment (word) @string)
|
(variable_assignment (word) @string)
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -61,7 +52,7 @@
|
||||||
"case"
|
"case"
|
||||||
"in"
|
"in"
|
||||||
"esac"
|
"esac"
|
||||||
] @conditional
|
] @conditional
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
|
|
@ -70,7 +61,7 @@
|
||||||
"select"
|
"select"
|
||||||
"until"
|
"until"
|
||||||
"while"
|
"while"
|
||||||
] @repeat
|
] @repeat
|
||||||
|
|
||||||
[
|
[
|
||||||
"declare"
|
"declare"
|
||||||
|
|
@ -78,7 +69,7 @@
|
||||||
"local"
|
"local"
|
||||||
"readonly"
|
"readonly"
|
||||||
"unset"
|
"unset"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
"function" @keyword.function
|
"function" @keyword.function
|
||||||
|
|
||||||
|
|
@ -89,17 +80,26 @@
|
||||||
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
|
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
|
||||||
|
|
||||||
((word) @boolean
|
((word) @boolean
|
||||||
(#any-of? @boolean "true" "false"))
|
(#any-of? @boolean "true" "false"))
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
(test_operator) @string
|
|
||||||
|
|
||||||
(command_substitution
|
(test_operator) @operator
|
||||||
[ "$(" ")" ] @punctuation.bracket)
|
|
||||||
|
|
||||||
(process_substitution
|
(command_substitution "$(" @punctuation.bracket)
|
||||||
[ "<(" ")" ] @punctuation.bracket)
|
(process_substitution "<(" @punctuation.bracket)
|
||||||
|
|
||||||
|
(arithmetic_expansion
|
||||||
|
[ "$((" "((" ] @punctuation.special
|
||||||
|
"))" @punctuation.special)
|
||||||
|
|
||||||
|
(arithmetic_expansion "," @punctuation.delimiter)
|
||||||
|
|
||||||
|
(ternary_expression [ "?" ":" ] @conditional.ternary)
|
||||||
|
|
||||||
|
(binary_expression operator: _ @operator)
|
||||||
|
(unary_expression operator: _ @operator)
|
||||||
|
(postfix_expression operator: _ @operator)
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
name: (word) @function)
|
name: (word) @function)
|
||||||
|
|
@ -124,15 +124,27 @@
|
||||||
(concatenation (word) @parameter)
|
(concatenation (word) @parameter)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
(number) @number
|
||||||
((word) @number
|
((word) @number
|
||||||
(#lua-match? @number "^[0-9]+$"))
|
(#lua-match? @number "^[0-9]+$"))
|
||||||
|
|
||||||
(file_redirect
|
(file_redirect
|
||||||
descriptor: (file_descriptor) @operator
|
descriptor: (file_descriptor) @operator
|
||||||
destination: (word) @parameter)
|
destination: (word) @parameter)
|
||||||
|
|
||||||
|
(simple_expansion
|
||||||
|
"$" @punctuation.special) @none
|
||||||
(expansion
|
(expansion
|
||||||
[ "${" "}" ] @punctuation.bracket)
|
"${" @punctuation.special
|
||||||
|
"}" @punctuation.special) @none
|
||||||
|
|
||||||
|
(expansion operator: _ @punctuation.special)
|
||||||
|
(expansion "@" . operator: _ @character.special)
|
||||||
|
|
||||||
|
((expansion
|
||||||
|
(subscript
|
||||||
|
index: (word) @character.special))
|
||||||
|
(#any-of? @character.special "@" "*"))
|
||||||
|
|
||||||
(variable_name) @variable
|
(variable_name) @variable
|
||||||
|
|
||||||
|
|
@ -145,4 +157,4 @@
|
||||||
(regex) @string.regex
|
(regex) @string.regex
|
||||||
|
|
||||||
((program . (comment) @preproc)
|
((program . (comment) @preproc)
|
||||||
(#lua-match? @preproc "^#!/"))
|
(#lua-match? @preproc "^#!/"))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
if (( $(tree-sitter parse test/Petalisp/**/*.lisp -q | wc -l) > 2 )); then
|
if (( $(tree-sitter parse test/Petalisp/**/*.lisp -q | wc -l) > 2 )); then
|
||||||
# ^ punctuation.bracket
|
# ^ punctuation.special
|
||||||
# ^ punctuation.bracket
|
# ^ punctuation.special
|
||||||
# ^ punctuation.bracket
|
# ^ punctuation.bracket
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue