Skip to content

Conversation

@loganj
Copy link

@loganj loganj commented Dec 3, 2025

No description provided.

loganj and others added 4 commits December 1, 2025 16:52
Add new boolean configuration option to FormattingOptions and wire it
through the command-line interface. This option will enable cascading
lambda break decisions to nested trailing lambdas, useful for DSLs
like Jetpack Compose.

Changes:
- Add cascadeNestedLambdaBreaks field to FormattingOptions data class
- Add --cascade-nested-lambda-breaks command-line flag to ParsedArgs
- Update CLI help text to document the new option
- Default value is false to maintain backward compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add parentLambdaBroke parameter to track parent lambda break state
through nested lambda expressions. Add helper method to identify
trailing lambdas that should inherit hierarchy preservation.

Changes:
- Add parentLambdaBroke parameter to visitLambdaExpressionInternal
- Add isTrailingLambda helper method to detect trailing lambdas
- Update method documentation to explain new parameter
- All call sites use default value (false) for now

No functional changes yet - context is passed but not used.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Implement the core cascading lambda break functionality. When
cascadeNestedLambdaBreaks is enabled and a parent lambda breaks to
multi-line, all nested trailing lambdas are forced to break as well,
preserving visual hierarchy.

Changes:
- Add insideBreakingLambda member variable to track break state
- Detect when current lambda will break to multi-line
- Force nested trailing lambdas to multi-line when parent broke
- Propagate break state through nested lambda visitor calls
- Update visitArgumentInternal and visitLambdaOrScopingFunction

The feature is now functional when --cascade-nested-lambda-breaks
flag is enabled. Backward compatible - default behavior unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add 7 comprehensive test cases covering various scenarios for the
cascadeNestedLambdaBreaks feature. Tests verify basic hierarchy
preservation, backward compatibility, deep nesting, edge cases, and
that only trailing lambdas are affected.

Changes:
- Add test for forcing nested lambda hierarchy when option enabled
- Add test for maintaining single line when option disabled
- Add test for forcing only trailing lambdas (not map/filter)
- Add test for forcing behavior when parent breaks
- Add test for preserving hierarchy with multiple statements
- Add test for handling deep nesting levels
- Add test for no effect on non-nested lambdas
- Fix containsTrailingLambdas to correctly detect nested lambdas
- Update break detection logic to handle hierarchy properly

All tests pass, feature fully functional.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@meta-cla
Copy link

meta-cla bot commented Dec 3, 2025

Hi @loganj!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

Document the new --cascade-nested-lambda-breaks command-line option
in the README with examples and usage guidelines. The documentation
explains how the feature helps preserve visual hierarchy in DSL code
like Jetpack Compose.

Changes:
- Add "Cascading Lambda Breaks" section to README.md
- Include usage examples showing before/after formatting
- Clarify that option only affects trailing lambdas
- Note that it's useful for DSLs with semantic nesting

Feature is now fully implemented, tested, and documented.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@loganj loganj force-pushed the issue-547-cascade-nested-lambda-breaks branch from 1885867 to 474ee2d Compare December 3, 2025 20:54
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.

1 participant