Remove UseProvidedBody string matching from DelegateBodySyntaxExtractor#96
Draft
Copilot wants to merge 3 commits intofeature/metehod_templatefrom
Draft
Remove UseProvidedBody string matching from DelegateBodySyntaxExtractor#96Copilot wants to merge 3 commits intofeature/metehod_templatefrom
Copilot wants to merge 3 commits intofeature/metehod_templatefrom
Conversation
Refactor the delegate body extraction to use structural syntax analysis instead of searching for the "UseProvidedBody" method name string. Changes: - DelegateBodySyntaxExtractor now finds the lambda by looking at the outermost invocation's lambda argument in the method's return expression, instead of scanning for "UseProvidedBody" string - FluentBodyResult gets HasDelegateBody flag indicating RuntimeDelegateBody was set in BodyGenerationData - BodyGenerationDataExtractor sets HasDelegateBody when RuntimeDelegateBody is non-null - GeneratesMethodGenerationPipeline executes the method first, then uses HasDelegateBody to decide if syntax extraction is needed - Add missing WithCompileTimeConstants implementations to fix pre-existing build errors in DataMethodBodyBuilders Co-authored-by: dex3r <3155725+dex3r@users.noreply.github.com> Agent-Logs-Url: https://github.com/dex3r/EasySourceGenerators/sessions/ea25cd90-2a07-42c1-8091-f255cb2c6687
…umption Co-authored-by: dex3r <3155725+dex3r@users.noreply.github.com> Agent-Logs-Url: https://github.com/dex3r/EasySourceGenerators/sessions/ea25cd90-2a07-42c1-8091-f255cb2c6687
Copilot
AI
changed the title
[WIP] Remove looking for body statement
Remove UseProvidedBody string matching from DelegateBodySyntaxExtractor
Mar 25, 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.
DelegateBodySyntaxExtractorsearched for lambdas by matching the string"UseProvidedBody"against method names in the syntax tree. This is fragile and unnecessary sinceBodyGenerationData.RuntimeDelegateBodyalready tells us whether a delegate body was provided.Approach
Instead of string-matching a method name, use the data from
BodyGenerationDatato decide when to extract, and structural position to decide what to extract:FluentBodyResult— AddedHasDelegateBodyflag, set whenRuntimeDelegateBodyis non-nullGeneratesMethodGenerationPipeline— Reversed the flow: execute the generator method first, then useHasDelegateBodyto conditionally trigger syntax extractionDelegateBodySyntaxExtractor— Replaced descendant-node scan for"UseProvidedBody"with structural lookup: find the outermostInvocationExpressionSyntaxin the method's return expression and extract its lambda argumentPre-existing fix
Added missing
WithCompileTimeConstantsand Stage5 implementations inDataMethodBodyBuilders.csto fix build errors on this branch.Original prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.