Invalid syntax highlighting with or condition `||`
Describe the bug
Syntax is invalid formatted with || at the begging of the line
To Reproduce Steps to reproduce the behavior: This workflow casuses invalid hightlighting on the last line:
name: "CI / CD"
on: workflow_call
jobs:
prepare:
name: "Prepare"
runs-on: "ubuntu-22.04"
outputs:
perform-tests: "${{ steps.should-perform-tests.outputs.perform-tests }}"
perform-lint: "${{ steps.should-perform-lint.outputs.perform-lint }}"
steps:
- name: "Should perform tests"
id: "should-perform-tests"
run: |
echo "perform-tests=1" >> $GITHUB_OUTPUT
- name: "Should perform lint"
id: "should-perform-lint"
run: |
echo "perform-lint=1" >> $GITHUB_OUTPUT
ci:
name: "CI"
runs-on: "ubuntu-22.04"
needs: ["prepare"]
if: >
needs.prepare.outputs.perform-lint == 1
|| needs.prepare.outputs.perform-tests == 1
Expected behavior The last line shouldn't be red and slanted.
Screenshots
Extension Version
v0.25.8
This issue is still present in v0.27.2.
Would be good to add expression and if to the title as I think this bug is specific to the special-cased if key (which evaluates expressions without requiring surrouunding by ${{ }})
MRE:
name: Format website code
on:
workflow_dispatch:
jobs:
format:
runs-on: ubuntu-latest
if: >
github.event_name == 'workflow_dispatch'
|| true
steps:
- uses: actions/checkout@v4
Note how the bug extends beyond the line with || true: the following line is also wrongly highlighted (orange not blue)
&& on line start is also buggy, but less so, just showing weird colors for each of the &&:
@corneliusroemer This issue should be fixed with #468.