Skip to content

Commit 262d000

Browse files
authored
feat: Add Dockerfile support (#221)
1 parent 115131f commit 262d000

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,9 @@
322322
branch = master
323323
update = none
324324
ignore = dirty
325+
[submodule "repos/dockerfile"]
326+
path = repos/dockerfile
327+
url = https://github.com/camdencheek/tree-sitter-dockerfile
328+
branch = main
329+
update = none
330+
ignore = dirty

queries/dockerfile/highlights.scm

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 @spell
30+
31+
(image_spec
32+
(image_tag
33+
":" @punctuation.special)
34+
(image_digest
35+
"@" @punctuation.special))
36+
37+
(double_quoted_string) @string
38+
39+
(expansion
40+
[
41+
"$"
42+
"{"
43+
"}"
44+
] @punctuation.special
45+
)
46+
47+
((variable) @constant
48+
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
49+
50+
(arg_instruction
51+
. (unquoted_string) @property)
52+
53+
(env_instruction
54+
(env_pair . (unquoted_string) @property))
55+
56+
(expose_instruction
57+
(expose_port) @number)
58+
59+
((stopsignal_instruction) @number
60+
(#match? @number "[0-9][0-9]?$"))
61+
62+
((stopsignal_instruction) @constant.builtin
63+
(#match? @constant.builtin "SIG(ABRT|HUP|INT|KILL|QUIT|STOP|TERM|TSTP)$"))

repos/dockerfile

Submodule dockerfile added at c0a9d69

tree-sitter-langs.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ See `tree-sitter-langs-repos'."
109109
(c++-mode . cpp)
110110
(d-mode . d)
111111
(dart-mode . dart)
112+
(dockerfile-mode . dockerfile)
112113
(css-mode . css)
113114
(elm-mode . elm)
114115
(elixir-mode . elixir)

0 commit comments

Comments
 (0)