From e4a686575c4f4775b8981986137de0678e34cd41 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Tue, 15 Jan 2019 12:17:09 -0800 Subject: [PATCH] Don't associate Roslyn workspace project with ProjectSnapshot. - Removed the differences of workspace project and `HostProject` in regards to `ProjectSnapshotManager` methods. We now just have `ProjectAdded`, `ProjectRemoved` etc. - Obsoleted Workspace related members from the `ProjectSnapshot`in order to ensure that current LiveShare continues to work. Once LiveShare has been incorporated into Razor we can remove these members from the project snapshot. - Removed several TagHelper calculating logic pieces from the document tracker. This is now done entirely from the ProjectSnapshotManager so there's no secondary route that needs to be taken in order to resolve TagHelpers for VS windows cases. - Updated the `ProjectState` to take in TagHelpers and removed the internal logic it had to resolve TagHelpers. - Added a TagHelpers property to ProjectSnapshot to indicate that they're no longer calculated, they're part of the project inputs. - Added a ProjectWorkspaceChange generator to be responsible for calculating any workspace related information that is needed for a `ProjectSnapshot`. For now, this just calculates TagHelpers but in the future it may do more. - Added a `FilePathComparison` static helper class which acts similarly to `FilePathComparer`. - Changed our dynamic file info provider to no longer care about `ProjectIds`. Before this, it kept track of the project ids internally but never used them so this is a noop functional change. - Changed how the out of process remote TagHelper resolution flow works. Prior to this you'd pass a Project across the wire as part of a project snapshot handle and then resolve TagHelpers the old fashioned way. - Updated all existing tests to respect the new `ProjectWorkspaceState` flows. - Added tests for new APIs. dotnet/aspnetcore-tooling#6672 \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/a5621641f839dfa8e43c8d3d6b01552bf308a1b9 --- .../ProjectSystem/BackgroundCodeGenerationBenchmark.cs | 2 +- .../ProjectSystem/ProjectLoadBenchmark.cs | 2 +- .../ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/BackgroundCodeGenerationBenchmark.cs b/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/BackgroundCodeGenerationBenchmark.cs index 40b903844b..db9c09aa4a 100644 --- a/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/BackgroundCodeGenerationBenchmark.cs +++ b/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/BackgroundCodeGenerationBenchmark.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Performance public void Setup() { SnapshotManager = CreateProjectSnapshotManager(); - SnapshotManager.HostProjectAdded(HostProject); + SnapshotManager.ProjectAdded(HostProject); SnapshotManager.Changed += SnapshotManager_Changed; } diff --git a/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectLoadBenchmark.cs b/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectLoadBenchmark.cs index 58baba8faf..73403ed515 100644 --- a/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectLoadBenchmark.cs +++ b/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectLoadBenchmark.cs @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Razor.Performance [Benchmark(Description = "Initializes a project and 100 files", OperationsPerInvoke = 100)] public void ProjectLoad_AddProjectAnd100Files() { - SnapshotManager.HostProjectAdded(HostProject); + SnapshotManager.ProjectAdded(HostProject); for (var i= 0; i < Documents.Length; i++) { diff --git a/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs b/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs index aab2fc4527..cd4251769c 100644 --- a/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs +++ b/src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs @@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Razor.Performance this._tagHelpers = tagHelpers; } - public override Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default) + public override Task GetTagHelpersAsync(Project project, ProjectSnapshot projectSnapshot, CancellationToken cancellationToken = default) { return Task.FromResult(new TagHelperResolutionResult(_tagHelpers, Array.Empty())); }