display underline for diagnostics

This commit is contained in:
Matt Parker
2025-08-18 18:20:15 +10:00
parent c0c240cf0e
commit ef5a4c4a64
5 changed files with 76 additions and 21 deletions

View File

@@ -1,12 +1,8 @@
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
using System.Linq;
using Godot;
using Microsoft.Build.Locator;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Host.Mef;
using SharpIDE.Application.Features.Analysis;
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
@@ -16,14 +12,18 @@ public partial class IdeRoot : Control
{
private Button _openSlnButton = null!;
private FileDialog _fileDialog = null!;
private SharpIdeCodeEdit _sharpIdeCodeEdit = null!;
public override void _Ready()
{
MSBuildLocator.RegisterDefaults();
_openSlnButton = GetNode<Button>("%OpenSlnButton");
_sharpIdeCodeEdit = GetNode<SharpIdeCodeEdit>("%SharpIdeCodeEdit");
_fileDialog = GetNode<FileDialog>("%OpenSolutionDialog");
_fileDialog.FileSelected += OnFileSelected;
_openSlnButton.Pressed += () => _fileDialog.Visible = true;
//_fileDialog.Visible = true;
OnFileSelected(@"C:\Users\Matthew\Documents\Git\BlazorCodeBreaker\BlazorCodeBreaker.slnx");
}
private async void OnFileSelected(string path)
@@ -33,6 +33,12 @@ public partial class IdeRoot : Control
GD.Print($"Selected: {path}");
var solutionModel = await VsPersistenceMapper.GetSolutionModel(path);
RoslynAnalysis.StartSolutionAnalysis(path);
var infraProject = solutionModel.AllProjects.Single(s => s.Name == "Infrastructure");
var diFile = infraProject.Files.Single(s => s.Name == "DependencyInjection.cs");
var fileContents = await File.ReadAllTextAsync(diFile.Path);
_sharpIdeCodeEdit.SetText(fileContents);
var diagnostics = await RoslynAnalysis.GetDocumentDiagnostics(diFile);
_sharpIdeCodeEdit.ProvideDiagnostics(diagnostics);
}
catch (Exception e)
{