diff --git a/runtime/queries/dockerfile/injections.scm b/runtime/queries/dockerfile/injections.scm index 5d3bbffb7..7db92804b 100644 --- a/runtime/queries/dockerfile/injections.scm +++ b/runtime/queries/dockerfile/injections.scm @@ -1,10 +1,10 @@ ((comment) @injection.content (#set! injection.language "comment")) -((shell_command - (shell_fragment) @injection.content) +((run_instruction + (shell_command) @injection.content) (#set! injection.language "bash") - (#set! injection.combined)) + (#set! injection.include-children)) ((run_instruction (heredoc_block) @injection.content) diff --git a/tests/query/highlights/dockerfile/bash-bleed-across-runs-regression.dockerfile b/tests/query/highlights/dockerfile/bash-bleed-across-runs-regression.dockerfile new file mode 100644 index 000000000..024c43ebd --- /dev/null +++ b/tests/query/highlights/dockerfile/bash-bleed-across-runs-regression.dockerfile @@ -0,0 +1,21 @@ +FROM python AS base +# <- @keyword + +RUN pip install requests && \ +# <- @keyword +# ^^^ @function.call +# ^^^ @variable.parameter + echo all done +# ^^^^ @function.call + +FROM alpine +# <- @keyword +# <- @!variable.parameter + +RUN apk add openssh-client +# <- @keyword +# ^^^ @function.call + +CMD ["/usr/bin/sh"] +# <- @keyword +# <- @!variable.parameter diff --git a/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile b/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile index 00621f1a3..68eb5c5b6 100644 --- a/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile +++ b/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile @@ -1,6 +1,11 @@ FROM foo RUN bar # ^ @bash +FROM haha +# ^ @!bash RUN \ baz # ^ @bash + +COPY apt apt +# ^ @!bash