harrydowning / yaml-embedded-languages

A VS Code syntax extension for embedded language highlighting in YAML
MIT License
22 stars 4 forks source link

YAML syntax highlighting after a #shell block breaks down due to for loop #15

Open sazima1 opened 3 months ago

sazima1 commented 3 months ago

When you use the # shell syntax highlighting, the rest of the YAML syntax highlighting will break down after you use for i in {1..60}; do. It is specifically the curly braces and first number specifying a sequence {1..60}. If you comment out the whole embedded code block, then start to type the line, it will break the YAML formatting right after you type "in {1". If you use the other for loop syntax for ((i = 0 ; i < 10 ; i++ )); do, the formatting is fine.

tidharm commented 2 weeks ago

This also happens when using heredoc to create a file:

- name: Setup Config Files
  run: | # shell
    echo "Setup Config Files"

    config_file_content=$(cat <<-EOF
    key1=value1
    key2=value2

    EOF
    )

    echo "$config_file_content" > config.ini

The syntax highlighting appears to break from the opening parenthesis of the $(cat <<-EOF bit. image

Before it, proper highlighting looks like this: image

After that, the rest of the yaml steps appear as inline strings and GH variables' braces appear as inner braces (purple rather than yellow): image

@sazima1 did you find any workaround for this?

sazima1 commented 2 weeks ago

@tidharm, no I have not found a workaround, sadly.