adrhumphreys / vscode-silverstripe

Basic template syntax highlighting for Silver Stripe template files.
https://marketplace.visualstudio.com/items?itemName=adrianhumphreys.silverstripe
MIT License
5 stars 12 forks source link

Highlighting breaks after invalid css in <style> tag #22

Open OldStarchy opened 4 years ago

OldStarchy commented 4 years ago

Smallest reproducable example is

<style>a</style>

data- attributes are highlighted differently for some reason. Adding {}</style> anywhere else in the file after the highlighting is broken will fix it.

<span class="foo" style="baz" data-foo="qux">bar</span>
<style>a</style>
<span class="foo" style="baz">bar</span>
<span class="foo" style="baz" data-foo="qux">bar</span>
{}</style>
<span class="foo" style="baz">bar</span>
<span class="foo" style="baz" data-foo="qux">bar</span>

image

I came accross this editing an email template that has HTML comment markers around the style content

<style>
  <!--
    .foo { bar: baz; }
  -->
</style>

However in this case I think its just treating --> as an unfinished selector.

The highlighting changes depending on the last bit of code before the closing </style> tag. The following three each have different results.

--> Not working
-->{ Not working, but different
-->{} OK

gorriecoe commented 4 years ago

This is a very similar issue to https://github.com/adrhumphreys/vscode-silverstripe/issues/12 in which case the issue is inherited from html syntax highlighting. I have had a look into this but am unsure how to resolve it as the html highlighting runs before ss highlighting and can'r be overridden.

gorriecoe commented 4 years ago

If you check other similar syntax highlighters such as blade or handlebars they have the same issue. If you find a syntax highlighter that resolves this maybe we could use it as a reference.

OldStarchy commented 4 years ago

In that case, it's better to raise this issue to the appropriate repo, which seems to be the main vscode repo itself.

OldStarchy commented 4 years ago

Never mind, I think I found an existing issue, I'll cross-link it.

https://github.com/textmate/html.tmbundle/issues/102

OldStarchy commented 4 years ago

I'll leave it to you if you want to close this issue or leave it open as an ongoing reminder to check the progress of the upstream issue.