From cf5faca8e0a4a76d69b283a5bdfd3dd50fcb67c6 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Thu, 28 May 2026 23:50:53 +0200 Subject: [PATCH] Fix script block meta scope Assign `meta.block.script.pipeline` to bash/pwsh script block nodes. --- YamlPipeline.sublime-syntax | 14 +++++++++----- tests/syntax_test_github_actions.yml | 16 ++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/YamlPipeline.sublime-syntax b/YamlPipeline.sublime-syntax index a630ab9..59d258a 100644 --- a/YamlPipeline.sublime-syntax +++ b/YamlPipeline.sublime-syntax @@ -66,7 +66,7 @@ contexts: ###[ POWERSHELL SCRIPT BLOCKS ]################################################ pwsh-block-node: - - meta_scope: meta.block.pwsh.pipeline + - meta_scope: meta.block.script.pipeline - include: pwsh-block-scalar - include: flow-scalar-pwsh-out @@ -117,9 +117,10 @@ contexts: - meta_include_prototype: false - include: comment - match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level - scope: source.powershell.embedded + scope: meta.block.script.pipeline source.powershell.embedded # note that we do not check if indentation is enough embed: embedded-pwsh + embed_scope: meta.block.script.pipeline escape: ^(?!\1|\s*$) pop: 1 - match: ^(?=\S) # the block is empty @@ -131,9 +132,10 @@ contexts: - meta_include_prototype: false - include: comment - match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level - scope: source.powershell.embedded + scope: meta.block.script.pipeline source.powershell.embedded # note that we do not check if indentation is enough embed: embedded-pwsh-folded + embed_scope: meta.block.script.pipeline escape: ^(?!\1|\s*$) pop: 1 - match: ^(?=\S) # the block is empty @@ -195,9 +197,10 @@ contexts: - meta_include_prototype: false - include: comment - match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level - scope: source.shell.bash.embedded + scope: meta.block.script.pipeline source.shell.bash.embedded # note that we do not check if indentation is enough embed: embedded-bash + embed_scope: meta.block.script.pipeline escape: ^(?!\1|\s*$) pop: 1 - match: ^(?=\S) # the block is empty @@ -209,9 +212,10 @@ contexts: - meta_include_prototype: false - include: comment - match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level - scope: source.shell.bash.embedded + scope: meta.block.script.pipeline source.shell.bash.embedded # note that we do not check if indentation is enough embed: embedded-bash-folded + embed_scope: meta.block.script.pipeline escape: ^(?!\1|\s*$) pop: 1 - match: ^(?=\S) # the block is empty diff --git a/tests/syntax_test_github_actions.yml b/tests/syntax_test_github_actions.yml index 625667e..e0733d4 100644 --- a/tests/syntax_test_github_actions.yml +++ b/tests/syntax_test_github_actions.yml @@ -97,16 +97,16 @@ jobs: run: | # <- meta.mapping.key.yaml meta.string.yaml string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline Write-Output Test -# <- source.powershell.embedded -#^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.powershell.embedded - source.powershell source.powershell +# <- meta.block.script.pipeline source.powershell.embedded +#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.script.pipeline source.powershell.embedded - source.powershell source.powershell # ^^^^^^^^^^^^ support.function - name: Test leading source.shell run: | # <- meta.mapping.key.yaml meta.string.yaml string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline echo Test -# <- source.shell.bash.embedded -#^^^^^^^^^^^^^^^^^^^ source.shell.bash.embedded - source.shell source.shell +# <- meta.block.script.pipeline source.shell.bash.embedded +#^^^^^^^^^^^^^^^^^^^ meta.block.script.pipeline source.shell.bash.embedded - source.shell source.shell # ^^^^ support.function # https://github.com/actions/checkout @@ -151,8 +151,8 @@ jobs: # ^ string.quoted.double.yaml punctuation.definition.string.end.yaml - meta.interpolation run: | if [[ "${{ matrix.sublime-build }}" == "latest" ]]; then - # <- source.yaml.pipeline.github-actions source.shell.bash.embedded - source.shell source.shell - #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.yaml.pipeline.github-actions source.shell.bash.embedded - source.shell source.shell + # <- source.yaml.pipeline.github-actions meta.block.script.pipeline source.shell.bash.embedded - source.shell source.shell + #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.yaml.pipeline.github-actions meta.block.script.pipeline source.shell.bash.embedded - source.shell source.shell # ^^ punctuation.section.compound.begin, support.function.test.begin # ^ punctuation.definition.string.begin # ^^^ punctuation.section.interpolation.begin @@ -173,8 +173,8 @@ jobs: fi tar xf st_syntax_tests.tar.xz rm st_syntax_tests.tar.xz -# <- source.shell.bash.embedded - source.shell source.shell -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.shell.bash.embedded - source.shell source.shell +# <- meta.block.script.pipeline source.shell.bash.embedded - source.shell source.shell +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.script.pipeline source.shell.bash.embedded - source.shell source.shell # ^^ source.shell meta.function-call.identifier variable.function - name: Run syntax tests # ^ punctuation.definition.block.sequence.item - source.shell