49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
@using System.Collections.Immutable
|
|
@using Microsoft.CodeAnalysis
|
|
@using SharpIDE.Application.Features.Analysis
|
|
@using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence
|
|
|
|
@if (_diagnostics.Length is not 0)
|
|
{
|
|
<MudTreeViewItem T="string" TextTypo="Typo.body2" EndTextTypo="Typo.caption" Expanded="false" Icon="@Icons.Material.Filled.Code" IconColor="Color.Success" Value="@ProjectModel.Name" Text="@ProjectModel.Name" EndText="@($"{_diagnostics.Length} diagnostics")">
|
|
@foreach (var diagnostic in _diagnostics)
|
|
{
|
|
<MudTreeViewItem T="string" TextTypo="Typo.body2" OnClick="@(async () => await OpenDocumentContainingDiagnostic(diagnostic))" Icon="@Icons.Material.Filled.Warning" IconColor="@GetDiagnosticIconColour(diagnostic)" Value="@diagnostic.ToString()">
|
|
<BodyContent>
|
|
<MudText Typo="Typo.body2">
|
|
@diagnostic.GetMessage()
|
|
<MudText Typo="Typo.caption" Style="color: var(--mud-palette-gray-dark)">@diagnostic.Id</MudText>
|
|
</MudText>
|
|
</BodyContent>
|
|
</MudTreeViewItem>
|
|
}
|
|
</MudTreeViewItem>
|
|
}
|
|
|
|
@code {
|
|
[Parameter, EditorRequired]
|
|
public SharpIdeProjectModel ProjectModel { get; set; } = null!;
|
|
|
|
private ImmutableArray<Diagnostic> _diagnostics = [];
|
|
|
|
private static Color GetDiagnosticIconColour(Diagnostic diagnostic) => diagnostic.Severity switch
|
|
{
|
|
DiagnosticSeverity.Error => Color.Error,
|
|
DiagnosticSeverity.Warning => Color.Warning,
|
|
DiagnosticSeverity.Info => Color.Info,
|
|
_ => Color.Info
|
|
};
|
|
|
|
private async Task OpenDocumentContainingDiagnostic(Diagnostic diagnostic)
|
|
{
|
|
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var diagnostics = await RoslynAnalysis.GetProjectDiagnostics(ProjectModel);
|
|
_diagnostics = diagnostics;
|
|
}
|
|
|
|
}
|