bugfix(formatter): Made cairofmt::skip work properly for additional items. - #10220
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR SummaryLow Risk Overview This change adds Reviewed by Cursor Bugbot for commit 497f16a. Bugbot is set up for automated code reviews on this repo. Configure here. |
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).

Summary
Extends
#[cairofmt::skip]support toTraitItemType,TraitItemConstant,TraitItemImpl, andItemMacroDeclarationnodes. Previously, applying#[cairofmt::skip]to trait associated types, constants, or impls, as well as macro declarations, had no effect because these syntax kinds were not handled inQueryAttrs. The attribute lookup now returns their attributes correctly, allowing the formatter to respect the skip directive.Type of change
Please check one:
Why is this change needed?
#[cairofmt::skip]was silently ignored when placed on trait associated types (type Bar), trait associated constants (const FOO: i32), trait associated impls (impl Baz: MyTrait), and macro declarations (macro my_macro { ... }). This was because theQueryAttrsimplementation forSyntaxNodedid not include match arms for these syntax kinds, so their attributes were never surfaced to the formatter.What was the behavior or documentation before?
Applying
#[cairofmt::skip]to trait item types, constants, impls, or macro declarations had no effect — the formatter would reformat those items regardless of the attribute.What is the behavior or documentation after?
#[cairofmt::skip]is now respected forTraitItemType,TraitItemConstant,TraitItemImpl, andItemMacroDeclaration, preserving their original formatting as written.Related issue or discussion (if any)
N/A
Additional context
Test cases covering all four newly supported node kinds have been added to
fmt_skip.cairoand its corresponding expected output file.