jeff-hykin / better-shell-syntax

💾 📦 ♻️ An improvement to the shell syntax for VS Code
MIT License
50 stars 4 forks source link

Bash Shell Script Syntax highlight problem after pipe and command with ; #90

Open alexr00 opened 1 month ago

alexr00 commented 1 month ago

The code with a problem is:

#!/usr/bin/bash

# broken while highlight after pipe
cat $foo |
while read i; do
    # broken done; highlight after output
    echo "output";
done;

# OK
cat $foo |

while read i; do
    echo "output"
done;

# OK
cat $foo | while read i; do
    echo "output";
done

# OK
cat $foo | while read i; do
    echo "output";
    # COMM
done;

It looks like:

image

The first read has:

string.unquoted.shell
meta.while.shell
meta.statement.shell
source.shelll

but the second read has:

support.function.builtin.shell
entity.name.command.shell
entity.name.function.call.shell
meta.statement.command.name.shell
meta.statement.command.shell
meta.statement.shell
meta.scope.while-loop.shell
source.shell

The first done has:

entity.name.command.shell
entity.name.function.call.shell
meta.statement.command.name.shell
meta.statement.command.shell
meta.statement.shell
source.shell

but the second done has:

keyword.control.shell
meta.scope.while-loop.shell
source.shell

It should look like:

I would expect that the squared read and the circled done should have the same color.

Originally from @gullevek in https://github.com/microsoft/vscode/issues/212572.