update sln diagnostics on type
This commit is contained in:
@@ -81,12 +81,7 @@ public static class RoslynAnalysis
|
||||
_codeFixProviders = _codeFixProviders.DistinctBy(s => s.GetType().Name).ToHashSet();
|
||||
_codeRefactoringProviders = _codeRefactoringProviders.DistinctBy(s => s.GetType().Name).ToHashSet();
|
||||
|
||||
foreach (var project in _sharpIdeSolutionModel.AllProjects)
|
||||
{
|
||||
var projectDiagnostics = await GetProjectDiagnostics(project);
|
||||
project.Diagnostics.Clear();
|
||||
project.Diagnostics.AddRange(projectDiagnostics);
|
||||
}
|
||||
await UpdateSolutionDiagnostics();
|
||||
foreach (var project in solution.Projects)
|
||||
{
|
||||
// foreach (var document in project.Documents)
|
||||
@@ -112,6 +107,18 @@ public static class RoslynAnalysis
|
||||
Console.WriteLine("RoslynAnalysis: Analysis completed.");
|
||||
}
|
||||
|
||||
public static async Task UpdateSolutionDiagnostics()
|
||||
{
|
||||
await _solutionLoadedTcs.Task;
|
||||
foreach (var project in _sharpIdeSolutionModel!.AllProjects)
|
||||
{
|
||||
var projectDiagnostics = await GetProjectDiagnostics(project);
|
||||
// TODO: only add and remove diffs
|
||||
project.Diagnostics.RemoveRange(project.Diagnostics);
|
||||
project.Diagnostics.AddRange(projectDiagnostics);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<ImmutableArray<Diagnostic>> GetProjectDiagnostics(SharpIdeProjectModel projectModel)
|
||||
{
|
||||
await _solutionLoadedTcs.Task;
|
||||
|
||||
@@ -63,12 +63,12 @@ public partial class ProblemsPanel : Control
|
||||
.SubscribeAwait(async (innerEvent, ct) => await (innerEvent.Action switch
|
||||
{
|
||||
NotifyCollectionChangedAction.Add => CreateDiagnosticTreeItem(_tree, treeItem, innerEvent),
|
||||
NotifyCollectionChangedAction.Remove => FreeTreeItem(e.OldItem.View.Value),
|
||||
NotifyCollectionChangedAction.Remove => FreeTreeItem(innerEvent.OldItem.View.Value),
|
||||
_ => Task.CompletedTask
|
||||
})).AddTo(this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private async Task CreateDiagnosticTreeItem(Tree tree, TreeItem parent, ViewChangedEvent<Diagnostic, TreeItemContainer> e)
|
||||
{
|
||||
await this.InvokeAsync(() =>
|
||||
|
||||
Reference in New Issue
Block a user