diff --git a/package.json b/package.json index 6b66111..9e719bc 100644 --- a/package.json +++ b/package.json @@ -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" + ] + } + ] } diff --git a/queries/highlights.scm b/queries/highlights.scm new file mode 100644 index 0000000..754faed --- /dev/null +++ b/queries/highlights.scm @@ -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 "^-") +)