Skip to content

Fix for having comments and text as root items - #30

Merged
berendkleinhaneveld merged 2 commits into
masterfrom
fix-formatting-with-root-comments
Jan 19, 2026
Merged

Fix for having comments and text as root items#30
berendkleinhaneveld merged 2 commits into
masterfrom
fix-formatting-with-root-comments

Conversation

@berendkleinhaneveld

@berendkleinhaneveld berendkleinhaneveld commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

Problem was an AttributeError:

Error formatting ./file.cgx: 'Comment' object has no attribute 'end'
Traceback (most recent call last):
  File "./.venv/lib/python3.13/site-packages/ruff_cgx/formatter.py", line 124, in format_cgx_content
    format_template(node) for node in parsed.template_nodes
    ~~~~~~~~~~~~~~~^^^^^^
  File "./.venv/lib/python3.13/site-packages/ruff_cgx/template_formatter.py", line 246, in format_template
    start, end = template_node.location[0] - 1, template_node.end[0]
                                                ^^^^^^^^^^^^^^^^^
AttributeError: 'Comment' object has no attribute 'end'

@berendkleinhaneveld
berendkleinhaneveld merged commit 61331be into master Jan 19, 2026
9 checks passed
@berendkleinhaneveld
berendkleinhaneveld deleted the fix-formatting-with-root-comments branch January 19, 2026 15:32
berendkleinhaneveld added a commit that referenced this pull request Jan 19, 2026
Includes:

* Fix for having comments or text in the component root (#30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant