fix(format): don't remove trailing comments when formatting is suppressed#9790
fix(format): don't remove trailing comments when formatting is suppressed#9790
Conversation
🦋 Changeset detectedLatest commit: 3f83bec The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will not alter performance
Comparing Footnotes
|
WalkthroughThis change addresses a formatting issue where trailing comments following a top-level Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_grit_formatter/src/verbatim.rs (1)
24-41:⚠️ Potential issue | 🟡 MinorRename to use consistent Grit naming.
The struct
FormatGraphqlVerbatimNodeand functionsformat_graphql_verbatim_node,format_bogus_node, andformat_suppressed_nodeoperate onGritSyntaxNodeandGritFormatContext, but use GraphQL naming. These should be renamed toFormatGritVerbatimNodeandformat_grit_verbatim_nodefor consistency.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_grit_formatter/src/verbatim.rs` around lines 24 - 41, The identifiers use "Graphql" but should use "Grit" consistently: rename the struct FormatGraphqlVerbatimNode to FormatGritVerbatimNode and the constructor function format_graphql_verbatim_node to format_grit_verbatim_node; likewise rename any related functions format_bogus_node and format_suppressed_node to use "grit" if they currently contain "graphql". Update the impl block and its Format<GritFormatContext> implementation to reference the new struct name, and change any uses of these symbols (calls/constructors, type annotations, derives) to the new names so they bind to GritSyntaxNode and GritFormatContext consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@crates/biome_grit_formatter/src/verbatim.rs`:
- Around line 24-41: The identifiers use "Graphql" but should use "Grit"
consistently: rename the struct FormatGraphqlVerbatimNode to
FormatGritVerbatimNode and the constructor function format_graphql_verbatim_node
to format_grit_verbatim_node; likewise rename any related functions
format_bogus_node and format_suppressed_node to use "grit" if they currently
contain "graphql". Update the impl block and its Format<GritFormatContext>
implementation to reference the new struct name, and change any uses of these
symbols (calls/constructors, type annotations, derives) to the new names so they
bind to GritSyntaxNode and GritFormatContext consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 18b468b4-0690-458e-abfd-c4fb30471fef
⛔ Files ignored due to path filters (13)
crates/biome_css_formatter/tests/specs/css/global_suppression.css.snapis excluded by!**/*.snapand included by**crates/biome_css_formatter/tests/specs/css/suppression_trailing_comments.css.snapis excluded by!**/*.snapand included by**crates/biome_graphql_formatter/tests/specs/graphql/suppression.graphql.snapis excluded by!**/*.snapand included by**crates/biome_graphql_formatter/tests/specs/graphql/suppression_trailing_comments.graphql.snapis excluded by!**/*.snapand included by**crates/biome_grit_formatter/tests/specs/grit/global_suppression.grit.snapis excluded by!**/*.snapand included by**crates/biome_grit_formatter/tests/specs/grit/suppression_trailing_comments.grit.snapis excluded by!**/*.snapand included by**crates/biome_html_formatter/tests/specs/html/suppressions/global_suppression.html.snapis excluded by!**/*.snapand included by**crates/biome_html_formatter/tests/specs/html/suppressions/suppression_trailing_comments.html.snapis excluded by!**/*.snapand included by**crates/biome_js_formatter/tests/specs/js/module/global_suppression.js.snapis excluded by!**/*.snapand included by**crates/biome_js_formatter/tests/specs/js/module/suppression_trailing_comments.js.snapis excluded by!**/*.snapand included by**crates/biome_js_formatter/tests/specs/ts/suppressions_trailing_comments.ts.snapis excluded by!**/*.snapand included by**crates/biome_json_formatter/tests/specs/json/global_suppression.jsonc.snapis excluded by!**/*.snapand included by**crates/biome_json_formatter/tests/specs/json/suppression_trailing_comments.jsonc.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (21)
.changeset/itchy-hats-refuse.mdcrates/biome_css_formatter/src/verbatim.rscrates/biome_css_formatter/tests/specs/css/global_suppression.csscrates/biome_css_formatter/tests/specs/css/suppression_trailing_comments.csscrates/biome_graphql_formatter/src/verbatim.rscrates/biome_graphql_formatter/tests/specs/graphql/suppression.graphqlcrates/biome_graphql_formatter/tests/specs/graphql/suppression_trailing_comments.graphqlcrates/biome_grit_formatter/src/verbatim.rscrates/biome_grit_formatter/tests/specs/grit/global_suppression.gritcrates/biome_grit_formatter/tests/specs/grit/suppression_trailing_comments.gritcrates/biome_html_formatter/src/verbatim.rscrates/biome_html_formatter/tests/specs/html/suppressions/global_suppression.htmlcrates/biome_html_formatter/tests/specs/html/suppressions/suppression_trailing_comments.htmlcrates/biome_js_formatter/src/verbatim.rscrates/biome_js_formatter/tests/specs/js/module/global_suppression.jscrates/biome_js_formatter/tests/specs/js/module/suppression_trailing_comments.jscrates/biome_js_formatter/tests/specs/ts/suppressions_trailing_comments.tscrates/biome_json_formatter/src/verbatim.rscrates/biome_json_formatter/tests/specs/json/global_suppression.jsonccrates/biome_json_formatter/tests/specs/json/suppression_trailing_comments.jsonccrates/biome_yaml_formatter/src/verbatim.rs
Summary
Previously, we were throwing away some trivia after suppressed nodes. This PR fixes that.
Generated by gpt 5.4
fixes #9781
Test Plan
added snapshot tests
Docs