on master help sign in
Support dockerfiles (#1303)

* allow language.config (in languages.toml) to be passed in as a toml object * Change config field for languages from json string to toml object * remove indents on languages.toml config * fix: remove patch version from serde_json import in helix-core * Use same tree-sitter-zig as upstream/master * fix(completion_popup): Fixes #1256 * Update helix-term/src/ui/completion.rs * feat(languages): Add support for `Dockerfile`s * docs(cargo-xtask-docgen): * improvement(langs-dockerfile): Add `injection-regex` to `languages.toml` for `Dockerfile` * improvement(langs-dockerfile): Add injections.scm * Update .gitmodules Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

commitdba22c60ed7fc336ad619b1246333f0116b47bcd authorMidnight Exigent <36641328+midnightexigent@users.noreply.github.com> dateTue 21 Dec 2021, 10:22 (5 years ago) parent75a8b78
6 files changed+74
.gitmodules+4 book/src/generated/lang-support.md+1 helix-syntax/languages/tree-sitter-dockerfile+1 languages.toml+11 runtime/queries/dockerfile/highlights.scm+51 runtime/queries/dockerfile/injections.scm+6
.gitmodules+4
@@ -162,6 +162,10 @@
162162 path = helix-syntax/languages/tree-sitter-dart
163163 url = https://github.com/UserNobody14/tree-sitter-dart.git
164164 shallow = true
165+[submodule "helix-syntax/languages/tree-sitter-dockerfile"]
166+ path = helix-syntax/languages/tree-sitter-dockerfile
167+ url = https://github.com/camdencheek/tree-sitter-dockerfile.git
168+ shallow = true
165169[submodule "helix-syntax/languages/tree-sitter-fish"]
166170 path = helix-syntax/languages/tree-sitter-fish
167171 url = https://github.com/ram02z/tree-sitter-fish
book/src/generated/lang-support.md+1
@@ -8,6 +8,7 @@
88| cpp | ✓ | | | `clangd` |
99| css | ✓ | | | |
1010| dart | ✓ | | ✓ | `dart` |
11+| dockerfile | ✓ | | | `docker-langserver` |
1112| elixir | ✓ | | | `elixir-ls` |
1213| fish | ✓ | ✓ | ✓ | |
1314| glsl | ✓ | | ✓ | |
helix-syntax/languages/tree-sitter-dockerfilenew file+1

Submodule changed.

languages.toml+11
@@ -467,3 +467,14 @@ file-types = ["scala", "sbt"]
467467comment-token = "//"
468468indent = { tab-width = 2, unit = " " }
469469language-server = { command = "metals" }
470+
471+[[language]]
472+name = "dockerfile"
473+scope = "source.dockerfile"
474+injection-regex = "docker|dockerfile"
475+roots = ["Dockerfile"]
476+file-types = ["Dockerfile"]
477+comment-token = "#"
478+indent = { tab-width = 2, unit = " " }
479+language-server = { command = "docker-langserver", args = ["--stdio"] }
480+
runtime/queries/dockerfile/highlights.scmnew file+51
@@ -0,0 +1,51 @@
1+[
2+ "FROM"
3+ "AS"
4+ "RUN"
5+ "CMD"
6+ "LABEL"
7+ "EXPOSE"
8+ "ENV"
9+ "ADD"
10+ "COPY"
11+ "ENTRYPOINT"
12+ "VOLUME"
13+ "USER"
14+ "WORKDIR"
15+ "ARG"
16+ "ONBUILD"
17+ "STOPSIGNAL"
18+ "HEALTHCHECK"
19+ "SHELL"
20+ "MAINTAINER"
21+ "CROSS_BUILD"
22+] @keyword
23+
24+[
25+ ":"
26+ "@"
27+] @operator
28+
29+(comment) @comment
30+
31+
32+(image_spec
33+ (image_tag
34+ ":" @punctuation.special)
35+ (image_digest
36+ "@" @punctuation.special))
37+
38+(double_quoted_string) @string
39+
40+(expansion
41+ [
42+ "$"
43+ "{"
44+ "}"
45+ ] @punctuation.special
46+) @none
47+
48+((variable) @constant
49+ (#match? @constant "^[A-Z][A-Z_0-9]*$"))
50+
51+
runtime/queries/dockerfile/injections.scmnew file+6
@@ -0,0 +1,6 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
3+
4+([(shell_command) (shell_fragment)] @injection.content
5+ (#set! injection.language "bash"))
6+