panoply / vscode-liquid

💧Liquid language support for VS Code
https://marketplace.visualstudio.com/items?itemName=sissel.shopify-liquid
Other
171 stars 22 forks source link

Formatter does not like `:root` when style is inlined #128

Closed jasonhibbs closed 1 year ago

jasonhibbs commented 1 year ago

Extension is great, but I’ve got one issue in formatting.

While my style tag is inline, the :root selector is moved to strange places.

Here’s what I’m expecting:

    <style>
      /* Base */

      @import url('https://use.typekit.net/example.css');

      :root {
        --example-var: 16px;
      }
    </style>

Here’s what I’m getting:

    <style>
      /* Base */

      @import url('https://use.typekit.net/example.css');:root {
        --example-var: 16px;
      }
    </style>

When I remove the import and comment, I get:

    <style > :root 
    {
    --example-var: 16px;
    }
    </style>
panoply commented 1 year ago

Ouff. Interesting. Thanks for taking the time to submit an issue. I'll look into this asap and get out a patch. In the meantime wrap the :root selector in comment ignores, eg:

<style>
  /* Base */

  @import url('https://use.typekit.net/example.css');

  /* @prettify-ignore-start */
    :root {
      --example-var: 16px;
    }
  /* @prettify-ignore-end */

</style>
panoply commented 1 year ago

Shipping in 3.2.0