From ff59413fa675b1be4df360dd7a612aea98fb8da2 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Wed, 26 Nov 2025 00:12:45 +1000 Subject: [PATCH] rename methods --- .../Features/Analysis/RoslynAnalysis.cs | 32 +++---------------- src/SharpIDE.Godot/IdeRoot.cs | 2 +- src/SharpIDE.Photino/Layout/MainLayout.razor | 2 +- .../Features/Analysis/RoslynAnalysisTests.cs | 4 +-- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs b/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs index 71e7cc3..d6febd3 100644 --- a/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs +++ b/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs @@ -58,14 +58,14 @@ public class RoslynAnalysis(ILogger logger, BuildService buildSe public TaskCompletionSource _solutionLoadedTcs = null!; private SharpIdeSolutionModel? _sharpIdeSolutionModel; - public void StartSolutionAnalysis(SharpIdeSolutionModel solutionModel) + public void StartLoadingSolutionInWorkspace(SharpIdeSolutionModel solutionModel) { _solutionLoadedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); _ = Task.Run(async () => { try { - await Analyse(solutionModel); + await LoadSolutionInWorkspace(solutionModel); await UpdateSolutionDiagnostics(); } catch (Exception e) @@ -74,9 +74,9 @@ public class RoslynAnalysis(ILogger logger, BuildService buildSe } }); } - public async Task Analyse(SharpIdeSolutionModel solutionModel, CancellationToken cancellationToken = default) + public async Task LoadSolutionInWorkspace(SharpIdeSolutionModel solutionModel, CancellationToken cancellationToken = default) { - using var _ = SharpIdeOtel.Source.StartActivity($"{nameof(RoslynAnalysis)}.{nameof(Analyse)}"); + using var _ = SharpIdeOtel.Source.StartActivity($"{nameof(RoslynAnalysis)}.{nameof(LoadSolutionInWorkspace)}"); _logger.LogInformation("RoslynAnalysis: Loading solution {SolutionPath}", solutionModel.FilePath); _sharpIdeSolutionModel = solutionModel; var timer = Stopwatch.StartNew(); @@ -148,30 +148,6 @@ public class RoslynAnalysis(ILogger logger, BuildService buildSe // var refactoringProviders = CodeRefactoringProviderLoader.LoadCodeRefactoringProviders(assemblies, language); // _codeRefactoringProviders.AddRange(refactoringProviders); // } - - // foreach (var project in solution.Projects) - // { - // // foreach (var document in project.Documents) - // // { - // // var semanticModel = await document.GetSemanticModelAsync(); - // // Guard.Against.Null(semanticModel, nameof(semanticModel)); - // // var documentDiagnostics = semanticModel.GetDiagnostics().Where(d => d.Severity is not DiagnosticSeverity.Hidden).ToList(); - // // foreach (var diagnostic in documentDiagnostics) - // // { - // // var test = await GetCodeFixesAsync(document, diagnostic); - // // } - // // // var syntaxTree = await document.GetSyntaxTreeAsync(); - // // // var root = await syntaxTree!.GetRootAsync(); - // // // var classifiedSpans = await Classifier.GetClassifiedSpansAsync(document, root.FullSpan); - // // // foreach (var span in classifiedSpans) - // // // { - // // // var classifiedSpan = root.GetText().GetSubText(span.TextSpan); - // // // Console.WriteLine($"{span.TextSpan}: {span.ClassificationType}"); - // // // Console.WriteLine(classifiedSpan); - // // // } - // // } - // } - _logger.LogInformation("RoslynAnalysis: Analysis completed"); } /// Callers should call UpdateSolutionDiagnostics after this diff --git a/src/SharpIDE.Godot/IdeRoot.cs b/src/SharpIDE.Godot/IdeRoot.cs index 3593c9f..1b4505b 100644 --- a/src/SharpIDE.Godot/IdeRoot.cs +++ b/src/SharpIDE.Godot/IdeRoot.cs @@ -159,7 +159,7 @@ public partial class IdeRoot : Control _fileChangedService.SolutionModel = solutionModel; _sharpIdeSolutionModificationService.SolutionModel = solutionModel; Callable.From(_solutionExplorerPanel.BindToSolution).CallDeferred(); - _roslynAnalysis.StartSolutionAnalysis(solutionModel); + _roslynAnalysis.StartLoadingSolutionInWorkspace(solutionModel); _fileWatcher.StartWatching(solutionModel); var previousTabs = Singletons.AppState.RecentSlns.Single(s => s.FilePath == solutionModel.FilePath).IdeSolutionState.OpenTabs; diff --git a/src/SharpIDE.Photino/Layout/MainLayout.razor b/src/SharpIDE.Photino/Layout/MainLayout.razor index 72dcb04..e88688c 100644 --- a/src/SharpIDE.Photino/Layout/MainLayout.razor +++ b/src/SharpIDE.Photino/Layout/MainLayout.razor @@ -185,7 +185,7 @@ var solutionModel = await VsPersistenceMapper.GetSolutionModel(_solutionFilePath); _solutionModel = solutionModel; - RoslynAnalysis.StartSolutionAnalysis(solutionModel); + RoslynAnalysis.StartLoadingSolutionInWorkspace(solutionModel); } private CancellationTokenSource? _cancellationTokenSource = null!; diff --git a/tests/SharpIDE.Application.UnitTests/Features/Analysis/RoslynAnalysisTests.cs b/tests/SharpIDE.Application.UnitTests/Features/Analysis/RoslynAnalysisTests.cs index 5695afb..3c7c51d 100644 --- a/tests/SharpIDE.Application.UnitTests/Features/Analysis/RoslynAnalysisTests.cs +++ b/tests/SharpIDE.Application.UnitTests/Features/Analysis/RoslynAnalysisTests.cs @@ -36,10 +36,10 @@ public class RoslynAnalysisTests var sharpIdeApplicationProject = solutionModel.AllProjects.Single(p => p.Name == "SharpIDE.Application"); roslynAnalysis._solutionLoadedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - await roslynAnalysis.Analyse(solutionModel, TestContext.Current.CancellationToken); + await roslynAnalysis.LoadSolutionInWorkspace(solutionModel, TestContext.Current.CancellationToken); // Act - foreach (var i in Enumerable.Range(1, 3)) + foreach (var i in Enumerable.Range(0, 3)) { var timer = Stopwatch.StartNew(); await roslynAnalysis.GetProjectDiagnostics(sharpIdeApplicationProject, TestContext.Current.CancellationToken);