Add simple highlight query

This commit is contained in:
Max Brunsfeld 2021-03-04 15:46:26 -08:00
parent 1de159fdd1
commit a8eb5cb57c
2 changed files with 64 additions and 1 deletions

View File

@ -24,5 +24,14 @@
"test": "tree-sitter test && script/parse-examples.sh",
"test-windows": "tree-sitter test"
},
"repository": "https://github.com/tree-sitter/tree-sitter-bash"
"repository": "https://github.com/tree-sitter/tree-sitter-bash",
"tree-sitter": [
{
"scope": "source.bash",
"file-types": [
"sh",
"bash"
]
}
]
}

54
queries/highlights.scm Normal file
View File

@ -0,0 +1,54 @@
[
(string)
(raw_string)
(heredoc_body)
(heredoc_start)
] @string
(command_name) @function
(variable_name) @property
[
"case"
"do"
"done"
"elif"
"else"
"esac"
"export"
"fi"
"for"
"function"
"if"
"in"
"unset"
"while"
"then"
] @keyword
(comment) @comment
(function_definition name: (word) @function)
(file_descriptor) @number
[
(command_substitution)
(process_substitution)
(expansion)
]@embedded
[
"$"
"&&"
">"
">>"
"<"
"|"
] @operator
(
(command (_) @constant)
(#match? @constant "^-")
)