move analysis files

This commit is contained in:
Matt Parker
2025-08-11 20:20:30 +10:00
parent e2bf045025
commit eea4a41d7e
4 changed files with 55 additions and 40 deletions

View File

@@ -1,11 +0,0 @@
using Microsoft.CodeAnalysis.MSBuild;
namespace SharpIDE.Application.Features.SolutionDiscovery;
public class Progress : IProgress<ProjectLoadProgress>
{
public void Report(ProjectLoadProgress value)
{
Console.WriteLine($"{value.Operation} completed for {value.FilePath} ({value.TargetFramework}) in {value.ElapsedTime.TotalMilliseconds}ms");
}
}

View File

@@ -1,38 +0,0 @@
using System.Diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.MSBuild;
namespace SharpIDE.Application.Features.SolutionDiscovery;
public static class RoslynTest
{
public static async Task Analyse(string solutionFilePath)
{
var workspace = MSBuildWorkspace.Create();
var timer = Stopwatch.StartNew();
var solution = await workspace.OpenSolutionAsync(solutionFilePath, new Progress());
timer.Stop();
Console.WriteLine($"Solution loaded in {timer.ElapsedMilliseconds}ms");
Console.WriteLine();
// foreach (var project in solution.Projects)
// {
// Console.WriteLine($"Project: {project.Name}");
// foreach (var document in project.Documents)
// {
// Console.WriteLine($"Document: {document.Name}");
// 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);
// }
// }
// }
}
}