Skip to content

Invalid syntax highlighting with or condition || #224

Open

Description

@jacek-jablonski

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
image

Extension Version
v0.25.8

Activity

  1. moved this from Backlog 🗒 to Triaged 📝 in GitHub Actions VS Code Extensionon Jul 13, 2023
  2. corneliusroemer commented on Jul 3, 2025

    @corneliusroemer

    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)

    Image

    && on line start is also buggy, but less so, just showing weird colors for each of the &&:

    Image
  3. cdce8p commented on Jul 7, 2025

    @cdce8p

    @corneliusroemer This issue should be fixed with #468.

    Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions