From a8eb5cb57c66f74c63ab950de081207cccf52017 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 4 Mar 2021 15:46:26 -0800 Subject: [PATCH] Add simple highlight query --- package.json | 11 ++++++++- queries/highlights.scm | 54 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 queries/highlights.scm 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 "^-") +)