Formatter: emit canonical blank lines between class sections and methods (BT-985)#1029
Formatter: emit canonical blank lines between class sections and methods (BT-985)#1029
Conversation
…BT-985) - Always emit blank line between class leading comments and doc/header - Always emit blank line before first method regardless of state - Emit blank line between consecutive methods within a class Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdjusts the unparser's formatting for class-like constructs: inserts a blank line after non-doc leading comments, always adds a blank before the first method when methods exist, separates consecutive instance and class-side methods, and ensures a blank line between instance and class-side method groups. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/beamtalk-core/src/unparse/mod.rs`:
- Around line 197-201: The loop over class.class_methods currently only inserts
a blank line when i > 0, so the first class-side method isn’t separated from
preceding instance methods; update the condition in the class.class_methods
iteration so a blank line is also emitted when i == 0 and class.instance_methods
is non-empty (i.e., change the if to check `if i > 0 || (i == 0 &&
!class.instance_methods.is_empty())` or equivalent), ensuring you still call
docs.push(line()) in that case (references: class.class_methods,
class.instance_methods, docs.push(line())).
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
crates/beamtalk-core/src/unparse/mod.rs
There was a problem hiding this comment.
Pull request overview
This PR updates the Beamtalk AST unparser/formatter to emit canonical blank-line spacing within class definitions, aligning formatted output with the BT-985 formatting rules.
Changes:
- Emit a blank line between class leading comments and the doc comment/class header.
- Always emit a blank line before the first method in a class when any methods exist (independent of state/classState presence).
- Emit a blank line between consecutive methods (instance-side and class-side) within their respective method lists.
Address Copilot and CodeRabbit review feedback: emit a blank line between the last instance method and the first class-side method. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Fixes: https://linear.app/beamtalk/issue/BT-985
Test plan
beamtalk fmt-check examples/getting-started/src/hello.btreports no diffjust cipasses (2371 Rust tests, 886 stdlib/BUnit, 2208 Erlang tests)🤖 Generated with Claude Code
Summary by CodeRabbit