aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/dockerfile/highlights.scm50
-rw-r--r--queries/dockerfile/injections.scm3
4 files changed, 63 insertions, 0 deletions
diff --git a/README.md b/README.md
index f69620a7c..c3504cb5f 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [css](https://github.com/tree-sitter/tree-sitter-css) (maintained by @TravonteD)
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @Akin909)
- [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar)
+- [x] [dockerfile](https://github.com/camdencheek/tree-sitter-dockerfile) (maintained by @camdencheek)
- [ ] [elm](https://github.com/elm-tooling/tree-sitter-elm)
- [x] [erlang](https://github.com/AbstractMachinesLab/tree-sitter-erlang) (maintained by @ostera)
- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index ab3872d16..c2572eba6 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -64,6 +64,15 @@ list.cpp = {
maintainers = {"@theHamsta"},
}
+list.dockerfile = {
+ install_info = {
+ url = "https://github.com/camdencheek/tree-sitter-dockerfile",
+ branch = "main",
+ files = { "src/parser.c" },
+ },
+ maintainers = {"@camdencheek"},
+}
+
list.rust = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-rust",
diff --git a/queries/dockerfile/highlights.scm b/queries/dockerfile/highlights.scm
new file mode 100644
index 000000000..1d629648e
--- /dev/null
+++ b/queries/dockerfile/highlights.scm
@@ -0,0 +1,50 @@
+[
+ "FROM"
+ "AS"
+ "RUN"
+ "CMD"
+ "LABEL"
+ "EXPOSE"
+ "ENV"
+ "ADD"
+ "COPY"
+ "ENTRYPOINT"
+ "VOLUME"
+ "USER"
+ "WORKDIR"
+ "ARG"
+ "ONBUILD"
+ "STOPSIGNAL"
+ "HEALTHCHECK"
+ "SHELL"
+ "MAINTAINER"
+ "CROSS_BUILD"
+] @keyword
+
+[
+ ":"
+ "@"
+] @operator
+
+(comment) @comment
+
+(image_spec
+ (image_tag
+ ":" @punctuation.special)
+ (image_digest
+ "@" @punctuation.special))
+
+(double_quoted_string) @string
+
+(expansion
+ [
+ "$"
+ "{"
+ "}"
+ ] @punctuation.special
+)
+
+((variable) @constant
+ (#match? @constant "^[A-Z][A-Z_0-9]*$"))
+
+
diff --git a/queries/dockerfile/injections.scm b/queries/dockerfile/injections.scm
new file mode 100644
index 000000000..c1fdd3f99
--- /dev/null
+++ b/queries/dockerfile/injections.scm
@@ -0,0 +1,3 @@
+(comment) @comment
+
+(shell_command) @bash