feat(code-action): add "with" to "let/inherit" refactor action#768
Merged
Conversation
- Introduce code action to convert `with` expressions to `let/inherit` - Add implementation and tests for various scenarios, including: - Attribute set bodies, lambda bodies, multiple and nested variables - Alphabetical sorting and correct handling of variable shadowing - Action only offered when cursor is on `with` and variables are used - Update build configuration to include new code action sources
3 tasks
inclyc
reviewed
Jan 11, 2026
…ested with - Add unwrapParen and hasDirectlyNestedWith helpers to detect nested with chains - Only offer with-to-let code action for innermost with in nested expressions - Update tests to verify correct behavior for nested, parenthesized, and triple-nested cases - Document new restriction in WithToLet.h and test descriptions
inclyc
reviewed
Jan 12, 2026
Address review feedback to detect indirect nested with scopes. - Add getWithScopes() to VariableLookupAnalysis for tracking with scopes - Replace AST-based hasDirectlyNestedWith with semantic hasNestedWithScope - Add unit tests for getWithScopes in various nesting scenarios - Add integration tests for indirect nesting cases Ref: #768 (comment)
…ction - Update comments in VariableLookup.cpp and WithToLet.cpp for better grammar and readability - Clarify intent and semantics of code action logic - No functional code changes made
inclyc
approved these changes
Jan 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new code action that converts
withexpressions to explicitlet/inheritsyntax.Example transformation:
Features
Test Plan
Related