Skip to content

fix: update node filtering logic to exclude TABLE and ARRAY_OF_TABLE kinds#1528

Merged
ya7010 merged 1 commit intomainfrom
fix_issue_1527
Feb 26, 2026
Merged

fix: update node filtering logic to exclude TABLE and ARRAY_OF_TABLE kinds#1528
ya7010 merged 1 commit intomainfrom
fix_issue_1527

Conversation

@ya7010
Copy link
Copy Markdown
Collaborator

@ya7010 ya7010 commented Feb 26, 2026

fix: #1527

Copilot AI review requested due to automatic review settings February 26, 2026 06:23
@ya7010 ya7010 enabled auto-merge February 26, 2026 06:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where comments between key-value pairs and array-of-tables ([[...]]) sections were being incorrectly removed during formatting. The issue occurred because the node filtering logic in key_values_end_dangling_comments() only checked for TABLE nodes but not ARRAY_OF_TABLE nodes.

Changes:

  • Updated the filtering logic in Root::key_values_end_dangling_comments() to exclude both TABLE and ARRAY_OF_TABLE syntax nodes
  • Added a regression test (test_issue_1527_toml) that verifies comments before array-of-tables are preserved during formatting

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/tombi-ast/src/impls/root.rs Fixed the node filtering logic to exclude both TABLE and ARRAY_OF_TABLE kinds when collecting end dangling comments
crates/tombi-formatter/src/lib.rs Added regression test for issue #1527 to verify comments before array-of-tables are preserved

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ya7010 ya7010 merged commit 31fa1f5 into main Feb 26, 2026
14 checks passed
@ya7010 ya7010 deleted the fix_issue_1527 branch February 26, 2026 06:26
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.

Formatter removes comments infront of arrays of tables

2 participants