From 0c56e77047300f86de17cffe8a807497cd472485 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sun, 22 Sep 2024 16:37:58 +0200 Subject: [PATCH] Compatibility fixes for refactored Bash This commit fixes compatibility with some breaking changes introduced by https://github.com/sublimehq/Packages/pull/4024. CAUTION: It is not forward or backward compatible! --- Containerfile.sublime-syntax | 15 ++++++++++----- syntax_test_Containerfile.Dockerfile | 19 +++++++++++-------- syntax_test_WindowsDockerfile.Dockerfile | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Containerfile.sublime-syntax b/Containerfile.sublime-syntax index 98b2b2b..47eac7b 100644 --- a/Containerfile.sublime-syntax +++ b/Containerfile.sublime-syntax @@ -226,12 +226,12 @@ contexts: set: - match: $ pop: true - - include: scope:source.shell.bash#variable-value + - include: scope:source.shell.bash#literal-array-value - match: (?i)(ENV)\b captures: 1: keyword.context.containerfile set: - - scope:source.shell.bash#cmd-export-args-meta + - scope:source.shell.bash#cmd-args-meta - scope:source.shell.bash#cmd-export-args - match: (?i)(LABEL)\b captures: @@ -244,15 +244,20 @@ contexts: - match: (?i)HEALTHCHECK\b scope: keyword.other.containerfile set: + - scope:source.shell.bash#cmd-args-meta - scope:source.shell.bash#cmd-args - optional-cmd - optional-instruction-args - match: '{{onbuild_instruction}}(?=\s)' scope: keyword.other.containerfile - set: scope:source.shell.bash#cmd-args # TODO: set optional-instruction-args first? + set: + - scope:source.shell.bash#cmd-args-meta + - scope:source.shell.bash#cmd-args # TODO: set optional-instruction-args first? - match: '{{non_onbuild_instruction}}(?=\s)' scope: keyword.other.containerfile - set: scope:source.shell.bash#cmd-args + set: + - scope:source.shell.bash#cmd-args-meta + - scope:source.shell.bash#cmd-args shell-instruction: - match: '{{shell_instruction}}\b' @@ -342,5 +347,5 @@ contexts: - match: = scope: keyword.operator.assignment.bash set: - - scope:source.shell.bash#cmd-export-args-meta + - scope:source.shell.bash#cmd-args-meta - scope:source.shell.bash#cmd-export-args diff --git a/syntax_test_Containerfile.Dockerfile b/syntax_test_Containerfile.Dockerfile index 94a61e3..0c8aa18 100644 --- a/syntax_test_Containerfile.Dockerfile +++ b/syntax_test_Containerfile.Dockerfile @@ -77,9 +77,9 @@ RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poet # ^^^^ meta.parameter.option variable.parameter.option # ^ punctuation.definition.parameter # ^ keyword.operator.assignment.pipe -# ^^^^^^^^^^^^^^ meta.variable variable.other.readwrite +# ^^^^^^^^^^^^^^ variable.other.readwrite # ^ keyword.operator.assignment -# ^ meta.number.integer.decimal constant.numeric.value +# ^ meta.string string.unquoted.shell # ^^^^^^ meta.function-call.identifier variable.function ENV PATH "/root/.poetry/bin:/opt/venv/bin:${PATH}" @@ -91,7 +91,7 @@ ENV PATH "/root/.poetry/bin:/opt/venv/bin:${PATH}" # ^^^^^^^ meta.interpolation.parameter # ^ punctuation.definition.variable # ^ punctuation.section.interpolation.begin -# ^^^^ variable.other.readwrite +# ^^^^ variable.language.builtin # ^ punctuation.section.interpolation.end # ^ string.quoted.double punctuation.definition.string.end @@ -136,13 +136,13 @@ COPY --from=python_builder /opt /opt # Add the VirtualEnv to the beginning of $PATH ENV PATH="/opt/venv/bin:$PATH" # ^ keyword.context -# ^^^^ meta.function-call.arguments meta.variable variable.other.readwrite +# ^^^^ meta.function-call.arguments variable.language.builtin # ^ meta.function-call.arguments keyword.operator.assignment # ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments meta.string # ^ string.quoted.double punctuation.definition.string.begin # ^^^^^^^^^^^^^^ string.quoted.double -# ^ meta.interpolation.parameter variable.other.readwrite punctuation.definition.variable -# ^^^^ meta.interpolation.parameter variable.other.readwrite +# ^ meta.interpolation.parameter variable.language.builtin punctuation.definition.variable +# ^^^^ meta.interpolation.parameter variable.language.builtin # ^ string.quoted.double punctuation.definition.string.end # ------------------------------- @@ -219,7 +219,7 @@ RUN <