-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/Features/Core/Portable/AddImport/AbstractAddImportFeatureService.cs
Outdated
Show resolved
Hide resolved
@@ -75,14 +75,15 @@ internal static partial class FixAllContextHelper | |||
|
|||
allDiagnostics = await ProducerConsumer<ImmutableArray<Diagnostic>>.RunParallelAsync( | |||
source: projectsToFix, | |||
produceItems: static async (projectToFix, callback, args, cancellationToken) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContextHelper.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContextHelper.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.