vscode-hyperscript icon indicating copy to clipboard operation
vscode-hyperscript copied to clipboard

Syntax highlighting breaks with two single quotes

Open Nicero opened this issue 3 years ago • 5 comments

Thank you for your super handy extension! I think I found a bug. Copy/paste the following code into VisualStudio:

<body>
    <div>            
        <div id="error"></div>
        <input id="text">
        <button id="btnsubmit"
            _="on click if #text.value == '' then put 'Type somenthing' into #error wait 2s then put '' into #error">
            Button
        </button>
    </div>
</body>

You will notice that from the string Button downwards the syntax highlighting breaks. This is due to the two single quotes '' at the end of the hyperscript string.

If you add a space between the two quotes ' ' the syntax highlighting if recovered. Without the space syntax highlighting breaks.

This happens only with the last pair of quotes in the hyperscript string. If you add a space between the first quotes (near the ==) the behaviour does'nt change.

Nicero avatar Apr 08 '22 11:04 Nicero

I've managed to identify the cause of this problem. The solution will take a while however.

dz4k avatar Jun 13 '22 05:06 dz4k

Would be nice to have this fixed, as everything bellow this is just 'yellow' in my case :p

leandergangso avatar Sep 17 '23 00:09 leandergangso

Having the same issue here, @dz4k what would the fix entail?

Screenshot 2023-10-22 at 3 46 10 PM

danawoodman avatar Oct 22 '23 22:10 danawoodman

Having the same issue here, @dz4k what would the fix entail?

Screenshot 2023-10-22 at 3 46 10 PM

As a temporary fix, it might work to put end at the end of the line. (Not tested myself)

E.g. init call ... end

leandergangso avatar Oct 22 '23 23:10 leandergangso

For the code in question I changed to single quotes for _='...' and double quotes inside and it works.

danawoodman avatar Oct 23 '23 02:10 danawoodman