-
Notifications
You must be signed in to change notification settings - Fork 96
Remove Hybrid Tag #1309
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
Draft
stephanie-shopify
wants to merge
4
commits into
main
Choose a base branch
from
standalone-section-tag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+75
−467
Draft
Remove Hybrid Tag #1309
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
af297ba
Parse section as a standalone tag
stephanie-shopify dd72662
Treat endsection as an unknown tag instead of a parse error
stephanie-shopify 72e924a
Keep section out of lax tag recovery
stephanie-shopify 334cac7
Limit the endsection exception to endsection
stephanie-shopify File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@shopify/liquid-html-parser': patch | ||
| '@shopify/theme-check-common': patch | ||
| --- | ||
|
|
||
| Parse `section` as a standalone tag. Removes the hybrid block form, whose forward scan for `{% endsection %}` made files with many `section` tags parse in quadratic time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why was this here? why does removing hybrid tag change it?
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.
On
main, any end tag for a registered tag with no opener is a parse error ({% endrender %},{% endif %}, …).sectionis registered, so a lone{% endsection %}threw too. With the hybrid form, a pairedendsectionwas legitimate, and this test pinned that difference: paired parses, orphan throws.Once
sectionisn't a block, everyendsectionis effectively an orphan. Left alone, the legacy{% section %}…{% endsection %}form would go from "Unknown tag, other checks still run" to "whole file fails to parse" (theme-check skips every other check on files that fail to parse). So I exemptedendsectionfrom that throw, which is what flips this test. Other tags' end-tag errors are unchanged, and there's a regression test for that.This, the checker move and the new export all follow from removing the block form. They also cause a few remaining differences on already-invalid Liquid, which the tophat caught: different messages for a lone
endsection, one in{% liquid %}and one inside HTML, and Prettier output changes for those.<p>{% section 'x' %}y{% endsection %}</p>gets mangled.Alternative with zero behavior change: keep
sectionhybrid and replace the per-tag forward scan with one pass that pairs eachsectionwith itsendsection(like matching parentheses), per document and per{% liquid %}block. That's still linear in the worst case, and theme-check, Prettier and all existing tests stay as onmain. Removing the block form could then be a separate follow-up where the behavior change is the explicit point. I'm leaning that way. I'll check with CP, since removing hybrid was their suggestion.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.
dont want to do this. defeats purpose of removing hybrid section tag.