jeff-hykin / better-shell-syntax

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

Advanced parameter expansion can cause brackets to be miscolored on multiple lines #30

Closed andreicaba closed 7 months ago

andreicaba commented 1 year ago

Hello

Congrats for your work, first of all :) Good job! Here's a bug: after a certain character sequence, it stops factoring in the characters that remain to the right of the sequence. Example:

declare s a=(a b c)
{
    s=${a[-${#a[@]}]}
}

image

The last two characters "]}" seemed to not have been factored in - as the first opening "{" bracket has a different colour than the closing "}" bracket.

jeff-hykin commented 1 year ago

Congrats for your work, first of all :) Good job!

Thank you!

While there is a problem, I think bracket pair colorization is making the problem a lot worse. The outer pair of {} do seem to be tagged correctly by the syntax, but, as you mention, the ]} is the source of the problem. Because of the ]} the bracket pair colorization gets confused on what is a string and what is a bracket and then is mismatched.

I'll actually upgrade this issue to a much larger issue, which is that the syntax doesn't really support anything beyond the most basic form of parameter expansion

supported


not really supported:

jeff-hykin commented 7 months ago

As of v1.8.5 the bracket issue should be fixed. I'll use a new issue to track general parameter expansion