Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Autoindent code in visual studio code

Autoindent code in visual studio code

cgregnanin
Shopify Partner
26 0 6

Hi, I'm using visual studio code to edit the Dawn theme.
When I try to format the code the schema section is not formatted.
What is the best way to format code in .liquid files?

Replies 8 (8)

ThomasBorowski
Shopify Partner
803 71 242

Are you using this extension?

 

https://marketplace.visualstudio.com/items?itemName=sissel.shopify-liquid

★ Smart Upgrades, Tips and Tutorials for Shopify themes: cartpunk.com
Did my solution work? Help other Community members easily find the correct solution and apply it to their own stores by marking it as the Accepted Solution and giving it a Thumbs Up
cgregnanin
Shopify Partner
26 0 6

Yes, the liquid code and the json schema are not formatted.

I use ctrl+shift+i

ThomasBorowski
Shopify Partner
803 71 242

Try Ctrl+Shift+L, that should use the Liquid formatter provided by the extension. Or via the command palette enter format.

ksnip_20211123-210039.png

★ Smart Upgrades, Tips and Tutorials for Shopify themes: cartpunk.com
Did my solution work? Help other Community members easily find the correct solution and apply it to their own stores by marking it as the Accepted Solution and giving it a Thumbs Up
cgregnanin
Shopify Partner
26 0 6

Ctrl+Shift+L Don't work.

I have generated the .liquidrc in my workspace 

 

cgregnanin_0-1637700327380.png

 

ThomasBorowski
Shopify Partner
803 71 242

Then that .liquidrc file is likely not working as intended, I don't have that file and the formatting works correctly out of the box.

★ Smart Upgrades, Tips and Tutorials for Shopify themes: cartpunk.com
Did my solution work? Help other Community members easily find the correct solution and apply it to their own stores by marking it as the Accepted Solution and giving it a Thumbs Up
cgregnanin
Shopify Partner
26 0 6
What solution can I try ?
ThomasBorowski
Shopify Partner
803 71 242

I don't really know ¯\_(ツ)_/¯

 

Maybe post an issue on the extension's GitHub repo.

★ Smart Upgrades, Tips and Tutorials for Shopify themes: cartpunk.com
Did my solution work? Help other Community members easily find the correct solution and apply it to their own stores by marking it as the Accepted Solution and giving it a Thumbs Up
Darius90
Shopify Partner
44 1 11

Give this guy a medal! I always used ctrl+alt+f and thought the formatting was not working well and had no clue. CTRL +SHIFT + L is what I needed! Thank you!

...