Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a new consistent pattern for working with 'args' objects in callbacks #73749

Merged
merged 3 commits into from
May 28, 2024

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner May 28, 2024 21:44
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 28, 2024
@@ -228,11 +228,12 @@ private static bool IsHostOrRemoteWorkspace(Project project)
source: viableUnreferencedProjects,
produceItems: static async (project, onItemsFound, args, cancellationToken) =>
{
var (projectToAssembly, allSymbolReferences, maxResults, finder, exact, linkedTokenSource) = args;
Copy link
Member Author

Choose a reason for hiding this comment

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

the pattern is to take the args parameter (which here was written as args: (projectToAssembly, allSymbolReferences, maxResults, finder, exact, linkedTokenSource), and just take that full tuple and copy it into the variable as what we are dconstructing into. Then, within the body, we can refer to all the nice names again instead of hte args.XXX in every single place.

Copy link
Member Author

Choose a reason for hiding this comment

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

if we follow this pattern in the future, it will also make diffs easier, as the body code which got pushed into the lambda will stay the same.

@@ -75,14 +75,15 @@ internal static partial class FixAllContextHelper

allDiagnostics = await ProducerConsumer<ImmutableArray<Diagnostic>>.RunParallelAsync(
source: projectsToFix,
produceItems: static async (projectToFix, callback, args, cancellationToken) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

args

why change the name here?

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants