-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improves Liquid Support #5098
Improves Liquid Support #5098
Conversation
Brings support for Shopify Liquid Variation embedded code blocks which include: - {% schema %} - {% javascript %} - {% style %} - {% stylesheet %} In addition, line comment highlighting is now provided.
src/mode/liquid_highlight_rules.js
Outdated
}, | ||
{ | ||
token: "keyword.block", | ||
regex: /(?<={%-?)\s*([a-zA-Z_$][a-zA-Z0-9_$]+\b)/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are failing because node 12 doesn't support backreference in regexp, could we remove backreferences by using an additional state, or matching both the brace and the word in one rule with array token?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problems, I'll sort it today
This should clean things up. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #5098 +/- ##
==========================================
+ Coverage 86.60% 86.71% +0.10%
==========================================
Files 555 554 -1
Lines 42931 42953 +22
Branches 6697 6691 -6
==========================================
+ Hits 37181 37246 +65
+ Misses 5750 5707 -43
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Merged, thank you! |
This PR overhauls Liquid grammar mode and brings support for embedded code regions and introduces a more refined approach to dealing with custom Liquid variations in circulation. The most notable changes are as follows:
External Code Regions
In the Shopify Liquid variation, external code regions are a thing. This PR brings support for:
{% schema %}
- JSON Language{% style %}
- CSS Language{% stylesheet %}
CSS Language{% javascript %}
JavaScript LanguageAllow any filter or tag name expression be provided
The previous approach of the Liquid grammar in Ace would apply highlighting according to a predetermined list of tag and filter names. This is not applicable given that custom tags and filter can be made available in different variations. This PR sloves that using grammars which determine highlighting according to syntactic structures.
Support Line Comments
Liquid now support line comment tokens, e.g:
{% # comment %}
which are singleton types. This PR brings support for this.Purged Token Mode Test File
Unsure of the exact appropriation logic for the
tokens_liquid.json
file but presume it was introduced and used in older legacy versions of Ace. Given the overhaul applied in this PR and new token names used to describe syntax formations results in a test failure because matching assertions differ based on the changes. I would happily produce exhaustive coverage here but I don't have that much time on my hands and found it difficult to follow generation guide. In any sense, the things work fine and I tested across all tm's.Updated Kitchen Sink Sample
Logical changes applied to the
liquid.liquid
kitchen sink file.