get project diagnostics

This commit is contained in:
Matt Parker
2025-08-17 11:16:53 +10:00
parent eecc0ed388
commit de89cfb1e9
4 changed files with 50 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
@using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence
<MudStack Style="height: 100%">
<MudStack Style="height: 100%; overflow-y: scroll">
@foreach (var project in SolutionModel.AllProjects)
{
<ProjectProblemComponent ProjectModel="@project" />
}
</MudStack>
@code {

View File

@@ -0,0 +1,29 @@
@using System.Collections.Immutable
@using Microsoft.CodeAnalysis
@using SharpIDE.Application.Features.Analysis
@using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence
@if (_diagnostics.Length is not 0)
{
@ProjectModel.Name
@foreach(var diagnostic in _diagnostics)
{
<div>
<strong>@diagnostic.Id</strong>: @diagnostic.GetMessage()
</div>
}
}
@code {
[Parameter, EditorRequired]
public SharpIdeProjectModel ProjectModel { get; set; } = null!;
private ImmutableArray<Diagnostic> _diagnostics = [];
protected override async Task OnInitializedAsync()
{
var diagnostics = await RoslynAnalysis.GetProjectDiagnostics(ProjectModel);
_diagnostics = diagnostics;
}
}

View File

@@ -4,6 +4,7 @@
@using SharpIDE.Application.Features.Events
@using SharpIDE.Application.Features.SolutionDiscovery
@using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence
@using SharpIDE.Photino.Components.Problems
@using SharpIDE.Photino.Models
@inherits LayoutComponentBase