Skip to content

Commit

Permalink
Add simple highlight query
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Mar 4, 2021
1 parent 1de159f commit a8eb5cb
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 54 additions & 0 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -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 "^-")
)

0 comments on commit a8eb5cb

Please sign in to comment.