Skip to content

Conversation

@jasonmalinowski
Copy link
Member

Right now we have the logic for which analyzers get added to a workspace in Program.cs, which calls a special method that specifically initializes the main host workspace. This refactors it so that could be used to initialize any workspace, and removes any tricky ordering problems that might happen by using cleaner MEF imports when we have them.

@jasonmalinowski jasonmalinowski requested a review from a team as a code owner April 4, 2025 23:44
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 4, 2025
Right now we have the logic for which analyzers get added to a workspace
in Program.cs, which calls a special method that specifically
initializes the main host workspace. This refactors it so that could
be used to initialize any workspace, and removes any tricky ordering
problems that might happen by using cleaner MEF imports when we have
them.
@jasonmalinowski jasonmalinowski force-pushed the simplify-workspace-initialization branch from 9033536 to 55fbdc3 Compare April 4, 2025 23:45
public ProjectTargetFrameworkManager TargetFrameworkManager { get; }

public async Task InitializeSolutionLevelAnalyzersAsync(ImmutableArray<string> analyzerPaths)
public ImmutableArray<AnalyzerFileReference> CreateSolutionLevelAnalyzerReferencesForWorkspace(Workspace workspace)
Copy link
Member Author

Choose a reason for hiding this comment

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

@RikkiGibson Now you could just MEF import this type and call this method and that'd give you your list of AnalyzerFileReferences that could be used for any workspace.

@jasonmalinowski jasonmalinowski merged commit 60ea270 into dotnet:main Apr 5, 2025
25 checks passed
@jasonmalinowski jasonmalinowski deleted the simplify-workspace-initialization branch April 5, 2025 01:35
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 5, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
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 VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants