Open jasonmalinowski opened 3 years ago
(filed per the comment on https://github.com/dotnet/roslyn/pull/49050/files/4c15723d73ae5558f1d724d511ba5411b5c72157#r514497891)
We attempted to do this in past, but I thought we were missing the right APIs and ended up needing to duplicate the logic of loading/finding analyzers, which is a bit problematic. Is there now an API that we can consume?
It's unclear to me; it looks like the only internal bit is the dealing with analyzers with load errors, which is also conveniently commented out. So... ¯_(ツ)_/¯
Currently the top-level analyzer nodes are populated based on the results of target CollectAnalyzersDesignTime
defined here:
The dependencies tree shouldn't have logic about specific types of dependency. Can we move any filtering logic to the SDK or MSBuild?
We could move it to MSBuild, although I think we'd have to write another build task for that.
MSBuild seems like the right place for this.
No Project System changes would be required. Should this issue be transferred, and if so to whom?
What would the filtering logic have to look like? Are we adding metadata to the items or doing something else?
Also, which MSBuild targets files would the changes have to go in?
For the legacy project system, Roslyn has logic to avoid showing analyzer nodes in certain cases to keep the list smaller. In our CPS project system, these nodes are made by this code in this repo but there is no equivalent filtering.
The current Roslyn code (warning: it's being tweaked a bit for generators) is visible here: https://github.com/dotnet/roslyn/blob/d8eb54d3c56f3b8415eb713b94759bce085e13c7/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItem/AnalyzerItemSource.cs#L209