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 the project cone information in Scope.FindAssetsAsync (part 2) #72512

Merged
merged 26 commits into from
Mar 13, 2024

Conversation

CyrusNajmabadi
Copy link
Member

Followup to #72509.

This avoids full solution level searches in scenarios where a project cone is being searched. This was particularly bad when the AssetHint didn't indicate a project/document.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 12, 2024
@@ -14,6 +14,21 @@

namespace Microsoft.CodeAnalysis;

internal readonly struct ProjectCone(ProjectId rootProjectId, IReadOnlySet<ProjectId> projectIds) : IEquatable<ProjectCone>
Copy link
Member Author

Choose a reason for hiding this comment

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

Core idea is that we have a strongly-typed view of the cone that we can capture in the scope object. That cone info can help reduce unnecessary work with syncing.

return AsyncLazy.Create(static (arg, c) =>
arg.self.ComputeChecksumsAsync(arg.projectConeId, c),
arg: (self: this, projectConeId));
}
Copy link
Member Author

Choose a reason for hiding this comment

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

inlined this. no need for the local function since Todd moved this to static lambdas.

_lazyChecksums = AsyncLazy.Create(static (self, c) =>
self.ComputeChecksumsAsync(projectId: null, c),
arg: this);
_lazyChecksums = AsyncLazy.Create(static async (self, cancellationToken) =>
Copy link
Member Author

Choose a reason for hiding this comment

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

style preference. i like to use cancellationToken for callbacks. that way if there is a cancellationToken in scope, it will hide it and we don't accidentally capture the wrong thing. less relevant for static lambdas. but i like to be consistent with that.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review March 12, 2024 20:15
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 12, 2024 20:15
@CyrusNajmabadi CyrusNajmabadi requested a review from ToddGrun March 12, 2024 20:15
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:

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@CyrusNajmabadi CyrusNajmabadi merged commit 629715c into dotnet:main Mar 13, 2024
27 of 30 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Mar 13, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the projectConeWork branch March 13, 2024 01:29
@RikkiGibson RikkiGibson modified the milestones: Next, 17.10 P3 Mar 25, 2024
@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski For review when you get back.

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