-
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
Stop loading ISourceGenerators within VS entirely. #72835
Conversation
{ | ||
using var connection = CreateConnection<TService>(callbackTarget: null); | ||
return await connection.TryInvokeAsync(compilationState, projectId, invocation, cancellationToken).ConfigureAwait(false); | ||
} |
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.
helper overload for the case where we're asking about a particular project in the context of a particular SolutionCompilationState (first time we've needed to do that).
/// Whether or not the specified <paramref name="projectId"/> has source generators or not. | ||
/// </summary> | ||
ValueTask<bool> HasGeneratorsAsync( | ||
Checksum solutionChecksum, ProjectId projectId, CancellationToken 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.
Pretty self-explanatory.
{ | ||
using var generators = TemporaryArray<ISourceGenerator>.Empty; | ||
var generatorToAnalyzerReference = ImmutableDictionary.CreateBuilder<ISourceGenerator, AnalyzerReference>(); | ||
private static readonly ConditionalWeakTable<ProjectState, SourceGeneratorMap> s_projectStateToSourceGeneratorsMap = new(); |
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.
this was a simpler way to organize the existing information. ProjectState already has the language and analyzerreferences. It's also what callers already pass in. And it's a green node which rarely changes. Note: if it does change, we'll 'recompute' the SGs, but end up finding the same set, since the AnalyzerRef objects themselves cache and return the same instances.
/// process (if present) and having it make the determination, without the host necessarily loading generators | ||
/// itself. | ||
/// </summary> | ||
private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<bool>> s_hasSourceGeneratorsMap = new(); |
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.
new to this PR.
/// process (if present) and having it make the determination, without the host necessarily loading generators | ||
/// itself. | ||
/// </summary> | ||
private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<bool>> s_hasSourceGeneratorsMap = new(); |
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.
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.
tried, but it started getting very ugly/allocy
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState_SourceGenerators.cs
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState_SourceGenerators.cs
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState_SourceGenerators.cs
Outdated
Show resolved
Hide resolved
@jasonmalinowski For review when you get back. |
No description provided.