Add support for # style comments in {% liquid %} blocks#835
Merged
sebastienros merged 2 commits intomainfrom Oct 23, 2025
Merged
Add support for # style comments in {% liquid %} blocks#835sebastienros merged 2 commits intomainfrom
# style comments in {% liquid %} blocks#835sebastienros merged 2 commits intomainfrom
Conversation
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Extend parser to support comments in liquid tags
Add support for Oct 23, 2025
# style comments in {% liquid %} blocks
sebastienros
approved these changes
Oct 23, 2025
This was referenced Oct 27, 2025
This was referenced Nov 10, 2025
This was referenced Nov 17, 2025
This was referenced Nov 24, 2025
This was referenced Dec 1, 2025
This was referenced Feb 25, 2026
This was referenced Mar 16, 2026
This was referenced Mar 23, 2026
This was referenced Mar 30, 2026
This was referenced Apr 6, 2026
This was referenced Apr 13, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes the issue where lines starting with
#inside{% liquid %}blocks were not treated as comments, causing the parser to skip subsequent statements.Problem
Previously, when using
#comments inside{% liquid %}blocks, the parser would stop processing statements after encountering the comment line:{% liquid assign name = 'John' # very important information assign name = 'Jenna' echo name %}Expected output:
JennaActual output: `` (empty)
The
assign name = 'Jenna'andecho namestatements were being skipped.Solution
Modified the
LiquidTagparser to recognize#as a valid tag identifier in addition to regular identifiers. This allows the parser to properly handle#comments within liquid blocks by leveraging the existing inline comment infrastructure.The key change is in
FluidParser.cs, where the liquid tag parser now uses:This allows
#to be recognized and processed by theInlineCommentTaghandler, which correctly consumes the rest of the line as a comment (since inside liquid blocks, newlines act as tag terminators).Testing
Added comprehensive test coverage:
#comment functionality#with no content)All existing tests (1206) continue to pass, confirming backward compatibility.
Examples
Now works as expected:
{% liquid # required args: assign product = 'MyProduct' # optional args: assign should_show_border = true assign should_show_cursor = true echo product %}Output:
MyProduct✅Regular inline comments outside liquid blocks continue to work:
{% # this is an inline comment %} Hello WorldOutput:
Hello World✅Original prompt
Fixes #834
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.