Rafiq
Rafiq

Reputation: 1642

Syntax highlighting does not work on piped (|) shell commands in GitLab CI script block in VS Code

I am using Visual Studio Code for editing my code. All of my shell commands I put under -| in in a script block of a .gitlab-ci.yml, shows in amber color, like strings in individual shell commands.

In this example, everything inside if..fi shows in amber color:

deploy_gtn_application:
  stage: build
  script:
    - |
      if [[ -z "$release_versions" ]]; then
        echo "No release version found. Deployment aborting..."
        exit 1
      fi

How can I make syntax highlight working.

Upvotes: 0

Views: 19

Answers (1)

Benjamin W.
Benjamin W.

Reputation: 52451

There is a VS Code extension called YAML Embedded Languages which looks like it does what you're asking for. You'll have to leave a language hint as a comment:

deploy_gtn_application:
  stage: build
  script:
    - |  # shell
      if [[ -z "$release_versions" ]]; then
        echo "No release version found. Deployment aborting..."
        exit 1
      fi

Upvotes: 0

Related Questions