nefrob / vscode-just

VSCode syntax highlighting for just files
https://marketplace.visualstudio.com/items?itemName=nefrob.vscode-just-syntax
MIT License
71 stars 1 forks source link

Single-quotes break formatting #29

Closed macintacos closed 1 month ago

macintacos commented 2 months ago

Hello! Just started using this plugin, thanks for your work here.

The parser seems to break when you provide a single quote with no "closing" single-quote. I put "closing" in quotes because, in the context I was trying to use it (writing a comment) a "closing" quote doesn't make sense.

A screenshot is better to show you what's going on:

CleanShot 2024-08-26 at 14 44 41@2x

test:
    @echo "This is a valid justfile"

    # This is a comment with a quote because it's a part of a contraction
    @echo "Everything after this shows green text like a string, until I put another single-quote character."

    @echo "I will go ahead and do it here ' even though it doesn't really matter uh oh"
    @echo There is it again!'

    @echo Okay it is gone now.

It seems like GitHub also struggles rendering this (I reported something similar in the just repo a while ago here: https://github.com/casey/just/issues/1626)

nefrob commented 2 months ago

Quotes in comments definitely shouldn't break like shown above. Solving for single quotes within strings might not be possible in textmate grammars but worth investigating. I would think escaping the character would work as intended, ex. @echo "single \' quote".

nefrob commented 1 month ago

@macintacos this should be resolved. See the above code block in your comment now highlights as expected.