Add Edit Lambda command to expand LAMBDA call into LET#99
Merged
Conversation
Adds a ribbon button that replaces the active cell's exact call to a registered LAMBDA (e.g. =MyCalc(A1, B1 + 2)) with an equivalent =LET(...) that inlines parameters bound to call-site arguments followed by the LAMBDA body. The workbook Name definition is left untouched so rerunning LET to LAMBDA with the same name overwrites it. Closes #94 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lash With ExplicitExports=false, ExcelDNA auto-registers every public static method as a UDF. Both command classes had a public static Run method, causing 'Repeated function name: Run' on add-in load. Making them internal keeps them reachable from the same-assembly RibbonController while hiding them from UDF discovery. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- FormulaFormatter emits LET and LAMBDA blocks one binding/param per line at a 4-space indent, so both LET-to-LAMBDA storage and Edit Lambda output render legibly in Excel's formula bar and Name Manager. - Edit Lambda now folds a LET body into the outer LET rather than producing a LET-inside-LET, giving a single flat LET after expansion. - LET-to-LAMBDA dialog allows overwriting an existing LAMBDA with the same name (shown as an informational message, Save stays enabled). Names pointing to something that isn't a LAMBDA still block.
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.
Closes #94
Summary
=LET(...)inlining the LAMBDA's parameters bound to the call-site arguments.LambdaSignatureParserextracts(param1, ..., paramN, body)from a=LAMBDA(...)RefersTo(handles optional[x]brackets, nested commas, case-insensitive, whitespace-tolerant).EditLambdaCommanddetects=Name(args...)shape exactly (rejects trailing content, missing parens), resolves the name via Name Manager, and builds the expanded LET. The LAMBDA Name definition is left in place so rerunning LET to LAMBDA with the same name overwrites it.Example
MyCalc==LAMBDA(x, y, x * y + 1), active cell ==MyCalc(A1, B1 + 2)→ cell becomes
=LET(x, A1, y, B1 + 2, x * y + 1).Test plan
LambdaSignatureParserTests(14) andEditLambdaCommandTests(19) — 421 tests pass, 0 fail.LambdaLoader.InjectLambdapath).=SUM(A1:A10)), non-exact call (=MyCalc(A1) + 5), too many args — all show a clear message and make no change.🤖 Generated with Claude Code