From 00c4f67a29970bbf8cb23bb18bbaaeff0786c156 Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Sun, 19 Nov 2023 22:26:15 +0200 Subject: [PATCH] ensure leading whitespace to shell scripts is scoped as shell script --- YamlPipeline.sublime-syntax | 3 ++- tests/syntax_test_azure_devops3.yml | 4 ++++ tests/syntax_test_github_actions.yml | 7 +++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/YamlPipeline.sublime-syntax b/YamlPipeline.sublime-syntax index d25f4be..29096ee 100644 --- a/YamlPipeline.sublime-syntax +++ b/YamlPipeline.sublime-syntax @@ -90,13 +90,14 @@ contexts: pop: 1 embedded-bash: - - clear_scopes: 1 + #- clear_scopes: 1 - meta_include_prototype: false script-block-scalar-begin: - meta_include_prototype: false - include: comment - match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level + scope: source.shell.bash.embedded # note that we do not check if indentation is enough embed: embedded-bash escape: ^(?!\1|\s*$) diff --git a/tests/syntax_test_azure_devops3.yml b/tests/syntax_test_azure_devops3.yml index 3fbfcdc..f0535d3 100644 --- a/tests/syntax_test_azure_devops3.yml +++ b/tests/syntax_test_azure_devops3.yml @@ -55,3 +55,7 @@ jobs: displayName: 'Create work item on failure' - pwsh: echo $(Build.BuildNumber) //output updated build number # TODO: use powershell syntax above instead of Bash + - bash: | + echo 'testing123' +# <- source.yaml.pipeline.azure-devops source.shell.bash.embedded +# ^^^^ source.shell.bash meta.function-call.identifier support.function.echo diff --git a/tests/syntax_test_github_actions.yml b/tests/syntax_test_github_actions.yml index f0fc85e..e17cd81 100644 --- a/tests/syntax_test_github_actions.yml +++ b/tests/syntax_test_github_actions.yml @@ -131,6 +131,7 @@ 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 # ^^ support.function.test.begin # ^ punctuation.definition.string.begin # ^^^ punctuation.section.interpolation.begin @@ -155,9 +156,11 @@ jobs: - name: Run syntax tests # ^ punctuation.definition.block.sequence.item - source.shell run: | - cd st_syntax_tests - ./syntax_tests + cd st_syntax_tests && ./syntax_tests +# <- source.yaml.pipeline.github-actions source.shell.bash.embedded +# ^^ source.shell.bash meta.function-call.identifier support.function.cd env: +# ^^^ meta.mapping.key meta.string string.unquoted.plain.out # TODO: scope env var names as variables myNull: ${{ null }} # ^^^^ constant.language.null