-
-
Notifications
You must be signed in to change notification settings - Fork 187
Add support for # inline comment tag #833
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
Conversation
Co-authored-by: sebastienros <[email protected]>
|
These changes allow {% # this is a comment %}Remaining issue: Inside Example: {% liquid
assign name = 'John'
# very important information
assign name = 'Jenna'
echo name
%}Observed behavior:
Expected behavior: Lines starting with Goal: The example from the initial description: {% liquid
# required args:
assign product = product
# optional args:
assign should_show_border = should_show_border | default: true
assign should_show_cursor = should_show_cursor | default: true
%}@copilot can you take a look and prepare a PR to fix this problem? |
This PR adds support for the
#inline comment tag, as introduced in Shopify's Liquid PR #1498. This provides a simpler syntax for adding single-line comments without requiring an end tag.New Syntax
{% # This is an inline comment %}The inline comment tag supports whitespace trimming like other Liquid tags:
{%- # trimmed comment -%}Examples
Basic usage:
Hello {% # this is a comment %} WorldOutput:
Hello WorldWith whitespace trimming:
Hello{%- # comment -%}WorldOutput:
HelloWorldIn templates:
{% # Start of section %} {% assign name = 'John' %} {% # Output the greeting %} Hello {{ name }}! {% # End of section %}Output:
Hello John!Between control structures:
{% if true %} {% # This comment won't appear in output %} Success {% endif %}Output:
SuccessImplementation Details
CommentStatementAST node for consistency#as a special character (not a valid identifier)echo,break, andcontinue-) markers like other Liquid tagsTesting
Added comprehensive test coverage:
Fixes the issue requesting support for the # comment tag as referenced in the Shopify Liquid enhancement.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/Shopify/liquid/pulls/1498curl -s REDACTED(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #493
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.