You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add enhanced useBraces modes, structural indentation, and nextControlFlowPosition fixes
This fork adds several enhancements to formatting control and fixes bugs in control flow positioning:
New Features:
- Enhanced useBraces modes: whenFormattedMultiLine and onlyNeeded for finer control over brace usage
- Structural indentation mode for conditional expressions (ternary operators) that avoids deep nesting
- forceParentheses option to control when wrapping parentheses are added around expressions
- Helper functions (single_non_empty_stmt, push_always_true_condition) to optimize iterator usage
Bug Fixes:
- Fixed NextLineExceptAfterBrace hanging with try-catch-finally statements
- Fixed NextLineExceptAfterBrace for do-while statements to properly track block braces
- Fixed useBraces:whenNeeded to keep braces for function and variable declarations (strict mode requirement)
- Fixed multiple-statement blocks incorrectly returning false for brace requirements
Configuration Changes:
- Version bumped to 0.95.11+sf.2
- Made plugin URLs configurable via Cargo.toml metadata
- Uses version ranges for dependencies instead of exact pinning
Test Coverage:
- Added comprehensive test coverage for empty statements, dangling else, and control flow positioning
- Added regression tests for empty blocks and NextLineExceptAfterBrace behavior
- 671 tests passing
Performance Improvements:
- Eliminated Vec allocations in get_force_braces and brace-checking helpers
- Optimized to only create conditions when NextLineExceptAfterBrace is actually used
- Extracted common iterator patterns to reduce code duplication
0 commit comments