Shopify / theme-tools

Everything developer experience for Shopify themes
https://shopify.dev/docs/themes
MIT License
80 stars 24 forks source link

Fix web extension formatting #567

Closed Smintfy closed 2 weeks ago

Smintfy commented 2 weeks ago

What are you adding in this PR?

Solves https://github.com/Shopify/theme-tools/issues/562 which fixes the {% schema %} tag that wasn't getting reformatted in the web version of the extension.

https://github.com/user-attachments/assets/385d311f-d813-4dc5-a2ef-669f8605475c

It worked after I added thebabelPrettierPlugin from the prettier 'parser-babel' plugin.

import LiquidPrettierPlugin from '@shopify/prettier-plugin-liquid';
import babelPrettierPlugin from 'prettier/parser-babel';

export const vscodePrettierFormat: Format = async (textDocument) => {
    /* ... */
   return prettier.format(text, {
    parser: 'liquid-html',
    plugins: [
      LiquidPrettierPlugin as any,
      babelPrettierPlugin as any,
    ],
  });
};

Before you deploy

charlespwd commented 2 weeks ago

Checked out the code, ran the tests + build and everything is in order. Thank you!