diff --git a/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs b/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs index 990e40a..390579b 100644 --- a/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs +++ b/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs @@ -983,7 +983,7 @@ public class RoslynAnalysis(ILogger logger, BuildService buildSe { return false; } - + // This may not be perfect, as None Include="" seems to be returned here as one of the globs as Include, with no distinction of Compile vs None etc // TODO: Investigate getting the glob type (Compile, None, etc) var matchers = projectFileInfo.FileGlobs.Select(glob => diff --git a/src/SharpIDE.Godot/Features/CodeEditor/SharpIdeCodeEdit.cs b/src/SharpIDE.Godot/Features/CodeEditor/SharpIdeCodeEdit.cs index 1ef31ba..06fddb2 100644 --- a/src/SharpIDE.Godot/Features/CodeEditor/SharpIdeCodeEdit.cs +++ b/src/SharpIDE.Godot/Features/CodeEditor/SharpIdeCodeEdit.cs @@ -51,6 +51,7 @@ public partial class SharpIdeCodeEdit : CodeEdit private bool _fileChangingSuppressBreakpointToggleEvent; private bool _settingWholeDocumentTextSuppressLineEditsEvent; // A dodgy workaround - setting the whole document doesn't guarantee that the line count stayed the same etc. We are still going to have broken highlighting. TODO: Investigate getting minimal text change ranges, and change those ranges only private bool _fileDeleted; + private IDisposable? _projectDiagnosticsObserveDisposable; [Inject] private readonly IdeOpenTabsFileManager _openTabsFileManager = null!; [Inject] private readonly RunService _runService = null!; @@ -151,6 +152,7 @@ public partial class SharpIdeCodeEdit : CodeEdit { _currentFile?.FileContentsChangedExternally.Unsubscribe(OnFileChangedExternally); _currentFile?.FileDeleted.Unsubscribe(OnFileDeleted); + _projectDiagnosticsObserveDisposable?.Dispose(); GlobalEvents.Instance.SolutionAltered.Unsubscribe(OnSolutionAltered); if (_currentFile is not null) _openTabsFileManager.CloseFile(_currentFile); } @@ -259,7 +261,7 @@ public partial class SharpIdeCodeEdit : CodeEdit var project = ((IChildSharpIdeNode)_currentFile).GetNearestProjectNode(); if (project is not null) { - project.Diagnostics.ObserveChanged() + _projectDiagnosticsObserveDisposable = project.Diagnostics.ObserveChanged() .SubscribeAwait(async (innerEvent, ct) => { var projectDiagnosticsForFile = project.Diagnostics.Where(s => s.FilePath == _currentFile.Path).ToImmutableArray();