shopify - Enabling Liquid templating syntax highlight in webStorm/phpStorm
I wonder if someone managed to enable the Liquid templating engine (http://liquidmarkup.org/) syntax highlighting in WebStorm IDE (https://www.jetbrains.com/webstorm/), I work a lot on Shopify (http://www.shopify.com/) stores and really like using Webstorm for that purpose. Did anyone managed to get this working?
I found some resources regarding this issue on JetBrain's forum though it didn't quite got me anywhere, there is one dude who suggested using 'tmBundle (https://github.com/Shopify/liquid-tmbundle/)' and that might work if you do some dark magic.
The thread is: RUBY-7210 (http://youtrack.jetbrains.com/issue/RUBY-7210) and the official plugin request: JetBrain's plugins: Liquid Templating language request (https://plugins.jetbrains.com/wishlist/show?pr=&wid=404)
I've found out that Twig have a very similar syntax to Liquid, enabling the Twig plugin will highlight Liquid syntax and will keep the HTML highlight/autocomplete/emmet functionality working as opposed to the "textMate Liquid bundle".
Settings > Editor > File Types find "Twig" on that list and associate Liquid files with it by adding
*.liquid to the registered patterns section.
If you can't find Twig, download the official plugin from the "Browse repositores" or in the "install JetBrains plugin". If you can't find it there then download the plugin and install it manually by pressing "install plugin from disk": https://plugins.jetbrains.com/plugin/7303?pr= (https://plugins.jetbrains.com/plugin/7303?pr=)
You will also want to associate
.css files and
.js files so that Twig wouldn't run on those type of files.
The end result works like a charm! it's the best solution yet until some official plugin will come out, hope it helps someone.
To follow up on Ilia luk's answer (https://stackoverflow.com/a/29337624), PHP Storm now has Twig support built in—just enable the plug-in if it isn't already.
Adding to the styles for Shopify, since it adds JSON for settings. Enable JSON wrapping between schema tags in
Settings > Editor > Language Injections
Click add/plus button. Then add settings
Language ID = JSON
Places Patterns = + twigCustomStatement("schema")
Adding another answer here: RubyMine by JetBrains have Liquid syntax included with the IDE. There is a Liquid plugin that says IntelliJ Ultimate is compatible, but I couldn't get it to work: https://plugins.jetbrains.com/plugin/14388-liquid (https://plugins.jetbrains.com/plugin/14388-liquid)
JetBrains PHPStorm now has a Liquid Plugin (https://www.jetbrains.com/help/phpstorm/liquid.html) available. You have to have PHPStorm version 2020.2 or higher (that took me a while to figure out, I was on 2020.1).
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.