aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--book/src/generated/lang-support.md1
m---------helix-syntax/languages/tree-sitter-dockerfile0
-rw-r--r--languages.toml11
-rw-r--r--runtime/queries/dockerfile/highlights.scm51
-rw-r--r--runtime/queries/dockerfile/injections.scm6
6 files changed, 73 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index dcec2813..edfe3c39 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -162,6 +162,10 @@
path = helix-syntax/languages/tree-sitter-dart
url = https://github.com/UserNobody14/tree-sitter-dart.git
shallow = true
+[submodule "helix-syntax/languages/tree-sitter-dockerfile"]
+ path = helix-syntax/languages/tree-sitter-dockerfile
+ url = https://github.com/camdencheek/tree-sitter-dockerfile.git
+ shallow = true
[submodule "helix-syntax/languages/tree-sitter-fish"]
path = helix-syntax/languages/tree-sitter-fish
url = https://github.com/ram02z/tree-sitter-fish
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 24b75b64..c7054201 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -8,6 +8,7 @@
| cpp | ✓ | | | `clangd` |
| css | ✓ | | | |
| dart | ✓ | | ✓ | `dart` |
+| dockerfile | ✓ | | | `docker-langserver` |
| elixir | ✓ | | | `elixir-ls` |
| fish | ✓ | ✓ | ✓ | |
| glsl | ✓ | | ✓ | |
diff --git a/helix-syntax/languages/tree-sitter-dockerfile b/helix-syntax/languages/tree-sitter-dockerfile
new file mode 160000
+Subproject 7af32bc04a66ab196f5b9f92ac471f29372ae2c
diff --git a/languages.toml b/languages.toml
index 61eb47ec..50c6f7f9 100644
--- a/languages.toml
+++ b/languages.toml
@@ -467,3 +467,14 @@ file-types = ["scala", "sbt"]
comment-token = "//"
indent = { tab-width = 2, unit = " " }
language-server = { command = "metals" }
+
+[[language]]
+name = "dockerfile"
+scope = "source.dockerfile"
+injection-regex = "docker|dockerfile"
+roots = ["Dockerfile"]
+file-types = ["Dockerfile"]
+comment-token = "#"
+indent = { tab-width = 2, unit = " " }
+language-server = { command = "docker-langserver", args = ["--stdio"] }
+
diff --git a/runtime/queries/dockerfile/highlights.scm b/runtime/queries/dockerfile/highlights.scm
new file mode 100644
index 00000000..5a945fb9
--- /dev/null
+++ b/runtime/queries/dockerfile/highlights.scm
@@ -0,0 +1,51 @@
+[
+ "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
+) @none
+
+((variable) @constant
+ (#match? @constant "^[A-Z][A-Z_0-9]*$"))
+
+
diff --git a/runtime/queries/dockerfile/injections.scm b/runtime/queries/dockerfile/injections.scm
new file mode 100644
index 00000000..20396f1a
--- /dev/null
+++ b/runtime/queries/dockerfile/injections.scm
@@ -0,0 +1,6 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+([(shell_command) (shell_fragment)] @injection.content
+ (#set! injection.language "bash"))
+