Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

  • Understand the issue: Add XML documentation to generated code for better IDE navigation
  • Explore the repository structure and understand the generator code
  • Run existing tests to ensure baseline is working
  • Modify DurableTaskSourceGenerator.cs to add XML documentation with <see cref="..."/> links to:
    • Activity call methods (linking to activity class)
    • Orchestrator schedule methods (linking to orchestrator class)
    • Sub-orchestrator call methods (linking to orchestrator class)
    • DurableFunction activity call methods (linking to the function method)
  • Update ClassBasedSyntaxTests to expect the new XML documentation
  • Update AzureFunctionsTests to expect the new XML documentation
  • Fix test failures after merge with main (Mixed_OrchestratorActivityEntity_ClassBasedSyntax test)
  • Run tests to verify changes work correctly (38/38 passed)
  • Address code review feedback
  • Run code review (passed)
  • Security Summary: No security vulnerabilities introduced. Changes only add XML documentation comments to generated code.

Summary

This PR adds XML documentation comments with <see cref="..."/> links to the generated extension methods. This enables IDE "Go to Definition" functionality to navigate directly from the generated methods to the actual activity/orchestrator classes.

Example generated code (before):

public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, string input, TaskOptions? options = null)
{
    return ctx.CallActivityAsync<string>("MyActivity", input, options);
}

Example generated code (after):

/// <summary>
/// Calls the <see cref="MyActivity"/> activity.
/// </summary>
/// <inheritdoc cref="TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)"/>
public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, string input, TaskOptions? options = null)
{
    return ctx.CallActivityAsync<string>("MyActivity", input, options);
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Generated code makes it hard to navigate the call chain</issue_title>
<issue_description>Simply put, when I see a call like this in an orchestration:

await context.CallMyActivityAsync(myActivityInput);

and I click into it in my IDE or try to follow that call, the generated method is not helpful, because I can't navigate to the actual activity class:

public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, string input, TaskOptions? options = null)
{
    return ctx.CallActivityAsync<string>("MyActivity", input, options);
}

The generator could just as well produce output that enables navigation:

public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, string input, TaskOptions? options = null)
{
    return ctx.CallActivityAsync<string>(typeof(MyActivity).GetTaskName(), input, options);
}

The GetTaskName extension method is currently internal, but it should be made public anyway.

Alternatively, the generator could render xml documentation with a link to the activity class:

/// <summary>
/// Calls the <see cref="MyNamespace.MyActivity" /> activity.
/// </summary>
public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, string input, TaskOptions? options = null)
{
    return ctx.CallActivityAsync<string>("MyActivity", input, options);
}

</issue_description>

Comments on the Issue (you are @copilot in this section)

@cgillum Good point about the loss of ability to quickly navigate to the activity definition. I think this is worth fixing.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Improve code generation for better call chain navigation Add XML documentation with see cref links to generated code for better IDE navigation Dec 5, 2025
Copilot AI requested a review from YunchuWang December 5, 2025 22:34
@YunchuWang
Copy link
Member

@copilot fix failed tests

…for Mixed_OrchestratorActivityEntity_ClassBasedSyntax test

Co-authored-by: YunchuWang <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 7, 2025

@copilot fix failed tests

Fixed in 9af345b. The Mixed_OrchestratorActivityEntity_ClassBasedSyntax test was added from the main branch merge but was missing the XML documentation comments that the generator now produces. Updated the test expectations accordingly. All 38 tests pass now.

@YunchuWang YunchuWang marked this pull request as ready for review December 7, 2025 00:27
Copilot AI review requested due to automatic review settings December 7, 2025 00:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the code generator to add XML documentation comments with <see cref> links to all generated extension methods. This improvement enables IDE "Go to Definition" functionality, allowing developers to navigate directly from generated extension methods (like CallMyActivityAsync) to the actual activity, orchestrator, or Azure Function implementation.

Key Changes:

  • Added XML documentation with <summary> and <inheritdoc> tags to generated extension methods
  • Included <see cref> links that reference the source class/method for IDE navigation
  • Applied documentation consistently across orchestrator scheduling, sub-orchestrator calls, and activity calls

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Generators/DurableTaskSourceGenerator.cs Added XML documentation generation to AddOrchestratorCallMethod, AddSubOrchestratorCallMethod, and both AddActivityCallMethod overloads, with <see cref> links to source types/methods
test/Generators.Tests/ClassBasedSyntaxTests.cs Updated test expectations to include the new XML documentation for class-based orchestrators and activities
test/Generators.Tests/AzureFunctionsTests.cs Updated test expectations to include the new XML documentation for Azure Functions-based activities and orchestrators

@YunchuWang
Copy link
Member

tested locally, link is correctly genearted. signing off
image

@torosent torosent merged commit ce4a7c7 into main Dec 7, 2025
13 checks passed
@torosent torosent deleted the copilot/improve-call-activity-navigation branch December 7, 2025 17:16
@YunchuWang
Copy link
Member

Fixed #378

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.

Generated code makes it hard to navigate the call chain

3 participants