update project diagnostics in file on sln alteration

This commit is contained in:
Matt Parker
2025-10-18 00:43:16 +10:00
parent 11cb9c1deb
commit 639945007b
7 changed files with 25 additions and 20 deletions

View File

@@ -15,13 +15,10 @@ using Microsoft.CodeAnalysis.MSBuild;
using Microsoft.CodeAnalysis.Razor.SemanticTokens;
using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem;
using Microsoft.CodeAnalysis.Remote.Razor.SemanticTokens;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.CodeAnalysis.Text;
using SharpIDE.Application.Features.Analysis.FixLoaders;
using SharpIDE.Application.Features.Analysis.Razor;
using SharpIDE.Application.Features.Build;
using SharpIDE.Application.Features.Events;
using SharpIDE.Application.Features.SolutionDiscovery;
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
using SharpIDE.RazorAccess;

View File

@@ -15,6 +15,8 @@ public class GlobalEvents
public EventWrapper<SharpIdeProjectModel, Task> ProjectStoppedRunning { get; } = new(_ => Task.CompletedTask);
public EventWrapper<ExecutionStopInfo, Task> DebuggerExecutionStopped { get; } = new(_ => Task.CompletedTask);
public EventWrapper<SharpIdeFile, Task> IdeFileSavedToDisk { get; } = new(_ => Task.CompletedTask);
/// A document changed, project was reloaded etc. Document changes include unsaved changes in the IDE.
public EventWrapper<Task> SolutionAltered { get; } = new(() => Task.CompletedTask);
public FileSystemWatcherInternal FileSystemWatcherInternal { get; } = new();
}

View File

@@ -7,7 +7,7 @@ namespace SharpIDE.Application.Features.FilePersistence;
#pragma warning disable VSTHRD011
/// Holds the in memory copies of files, and manages saving/loading them to/from disk.
public class IdeFileManager
public class IdeOpenTabsFileManager
{
private ConcurrentDictionary<SharpIdeFile, Lazy<Task<string>>> _openFiles = new();
@@ -35,6 +35,7 @@ public class IdeFileManager
if (file.IsRoslynWorkspaceFile)
{
await RoslynAnalysis.UpdateDocument(file, newText);
GlobalEvents.Instance.SolutionAltered.InvokeParallelFireAndForget();
}
}
@@ -49,6 +50,7 @@ public class IdeFileManager
{
var text = await textTask;
await RoslynAnalysis.UpdateDocument(file, text);
GlobalEvents.Instance.SolutionAltered.InvokeParallelFireAndForget();
}
}