]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(dockerfile): Update syntax, fix RUN command highlighting
authorDoug Kearns <dougkearns@gmail.com>
Sun, 26 Apr 2026 14:26:19 +0000 (14:26 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 26 Apr 2026 14:26:19 +0000 (14:26 +0000)
Allow for docker comments to be interspersed in a multiline (continued)
RUN command argument.

fixes:  #8364
closes: #19829

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/dockerfile.vim
runtime/syntax/testdir/dumps/dockerfile_00.dump [new file with mode: 0644]
runtime/syntax/testdir/input/dockerfile.dockerfile [new file with mode: 0644]

index f1d612f4add181e8fcfacead792c1c29e3099cae..17b32d29424d852dc47b341f16d00a9147ad841f 100644 (file)
@@ -1,6 +1,7 @@
 " dockerfile.vim - Syntax highlighting for Dockerfiles
 " Maintainer:   Honza Pokorny <https://honza.ca>
 " Last Change:  2024 Dec 20
+"               2026 Mar 26 by Vim Project: dockerfileShell comments (#19829)
 " License:      BSD
 
 " https://docs.docker.com/engine/reference/builder/
@@ -31,7 +32,7 @@ syntax match dockerfileInstruction contained /\v<(SHELL|VOLUME)>/
 
 syntax region dockerfileString contained start=/\v"/ skip=/\v\\./ end=/\v"/
 syntax region dockerfileJSON   contained keepend start=/\v\[/ skip=/\v\\\_./ end=/\v$/ contains=@JSON
-syntax region dockerfileShell  contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=@Shell
+syntax region dockerfileShell  contained keepend start=/\v/ skip=/\v\\\_.|^\s*#.*/ end=/\v$/ contains=@Shell
 syntax region dockerfileValue  contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=dockerfileString
 
 syntax region dockerfileComment start=/\v^\s*#/ end=/\v$/ contains=@Spell
diff --git a/runtime/syntax/testdir/dumps/dockerfile_00.dump b/runtime/syntax/testdir/dumps/dockerfile_00.dump
new file mode 100644 (file)
index 0000000..6f55b91
--- /dev/null
@@ -0,0 +1,20 @@
+>#+0#0000e05#ffffff0| |I|s@1|u|e| |#|8|3|6|4| |(|D|o|c|k|e|r| |s|y|n|t|a|x| |h|i|g|h|l|i|g|h|t|i|n|g| |-| |C|o|m@1|e|n|t|s| |b|r|e|a|k| |u|p| |R|U|N| |h|i|g|h|l|i|g|h|t
+|i|n|g| +0#0000000&@71
+|#+0#0000e05&| |i|n| |m|u|l|t|i|-|l|i|n|e| |m|o|d|e|)| +0#0000000&@53
+@75
+|F+0#af5f00255&|R|O|M| +0#0000000&|d|e|b|i|a|n|:|1|0|.|3| @58
+@75
+|R+0#af5f00255&|U|N| +0#0000000&|a|p|t|-|g|e|t| |u|p|d|a|t|e| |-+0#e000e06&|y| +0#0000000&|\+0#af5f00255&| +0#0000000&@51
+@4|&+0#af5f00255&@1| +0#0000000&|a|p|t|-|g|e|t| |u|p|g|r|a|d|e| |-+0#e000e06&|y| +0#0000000&|\+0#af5f00255&| +0#0000000&@47
+@4|&+0#af5f00255&@1| +0#0000000&|a|p|t|-|g|e|t| |i|n|s|t|a|l@1| |-+0#e000e06&|y| +0#0000000&|c|u|r|l| |g+0#af5f00255&|r|e|p| +0#0000000&|s+0#af5f00255&|e|d| +0#0000000&|u|n|z|i|p| |g|i|t| |s|u|d|o| |j|q| |g|e|t@1|e|x|t| |\+0#af5f00255&| +0#0000000&@7
+@4|#+0#0000e05&| |A|z|u|r|e| |C|L|I| +0#0000000&@59
+@4|&+0#af5f00255&@1| +0#0000000&|c+0#af5f00255&|d| +0#0000000&|/|t|m|p| |\+0#af5f00255&| +0#0000000&@58
+@4|&+0#af5f00255&@1| +0#0000000&|c|u|r|l| |-+0#e000e06&|s|L| +0#0000000&|h|t@1|p|s|:|/@1|a|k|a|.|m|s|/|I|n|s|t|a|l@1|A|z|u|r|e|C|L|I|D|e|b| ||+0#af5f00255&| +0#0000000&|b|a|s|h| |\+0#af5f00255&| +0#0000000&@16
+@4|#+0#0000e05&| |C|l|e|a|n|-|u|p| |A|p|t| |C|a|c|h|e|s| +0#0000000&@49
+@4|&+0#af5f00255&@1| +0#0000000&|a|p|t|-|g|e|t| |c|l|e|a|n| |\+0#af5f00255&| +0#0000000&@52
+@4|&+0#af5f00255&@1| +0#0000000&|r+0#af5f00255&|m| +0#0000000&|-+0#e000e06&|r|f| +0#0000000&|/|v|a|r|/|l|i|b|/|a|p|t|/|l|i|s|t|s| @42
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
diff --git a/runtime/syntax/testdir/input/dockerfile.dockerfile b/runtime/syntax/testdir/input/dockerfile.dockerfile
new file mode 100644 (file)
index 0000000..0126470
--- /dev/null
@@ -0,0 +1,14 @@
+# Issue #8364 (Docker syntax highlighting - Comments break up RUN highlighting
+# in multi-line mode)
+
+FROM debian:10.3
+
+RUN apt-get update -y \
+    && apt-get upgrade -y \
+    && apt-get install -y curl grep sed unzip git sudo jq gettext \
+    # Azure CLI
+    && cd /tmp \
+    && curl -sL https://aka.ms/InstallAzureCLIDeb | bash \
+    # Clean-up Apt Caches
+    && apt-get clean \
+    && rm -rf /var/lib/apt/lists