Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change RazorProjectInfo to use HostProject and HostDocument #11030

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3218628
Remove HostDocumentComparer
DustinCampbell Oct 15, 2024
82a6d14
Move HostDocument to MS.ANC.Razor.ProjectEngineHost
DustinCampbell Oct 15, 2024
f123af0
Add JSON and MessagePack serialization for HostDocument
DustinCampbell Oct 15, 2024
67168aa
Replace DocumentSnapshotHandle with HostDocument
DustinCampbell Oct 15, 2024
0b85574
Remove DocumentSnapshotHandle
DustinCampbell Oct 15, 2024
871dac6
Clean up RazorProjectService.TestAccessor
DustinCampbell Oct 15, 2024
b1bfaad
Move HostProject to MS.ANC.Razor.ProjectEngineHost
DustinCampbell Oct 15, 2024
b6b95ac
Add JSON and MessagePack serialization for HostProject
DustinCampbell Oct 15, 2024
196ff15
Use HostProject within RazorProjectInfo
DustinCampbell Oct 15, 2024
78b6175
Remame RazorProjectInfo.ProjectKey to Key
DustinCampbell Oct 15, 2024
7bf4ca7
Use HostProject in RazorProjectService
DustinCampbell Oct 16, 2024
c3a7f90
Increment SerializationFormat version numbers
DustinCampbell Oct 16, 2024
e89fbfd
Tweak version check in MessagePack
DustinCampbell Oct 16, 2024
76d210c
Update serialized JSON test files
DustinCampbell Oct 16, 2024
3357d6c
Update parameter to ref readonly
DustinCampbell Oct 16, 2024
473b6d4
Remove unused local
DustinCampbell Oct 16, 2024
9e66c0c
Make rootNamespace non-nullable
DustinCampbell Oct 16, 2024
dbfd530
Merge branch 'main' into hostdocument-ftw
DustinCampbell Oct 22, 2024
ecbdde1
Merge branch 'main' into hostdocument-ftw
DustinCampbell Oct 23, 2024
8de93cb
Merge branch 'main' into hostdocument-ftw
DustinCampbell Nov 11, 2024
0de2fa8
Merge branch 'main' into hostdocument-ftw
DustinCampbell Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"__Version": 6,
"ProjectKey": "C:\\Users\\admin\\location\\Kendo.Mvc.Examples\\obj\\Debug\\net7.0\\",
"FilePath": "C:\\Users\\admin\\location\\Kendo.Mvc.Examples\\Kendo.Mvc.Examples.csproj",
"Configuration": {
"ConfigurationName": "MVC-3.0",
"LanguageVersion": "7.0",
"Extensions": [
"MVC-3.0"
]
"__Version": 7,
"HostProject": {
"FilePath": "C:\\Users\\admin\\location\\Kendo.Mvc.Examples\\Kendo.Mvc.Examples.csproj",
"IntermediateOutputPath": "C:\\Users\\admin\\location\\Kendo.Mvc.Examples\\obj\\Debug\\net7.0\\",
"Configuration": {
"ConfigurationName": "MVC-3.0",
"LanguageVersion": "7.0",
"Extensions": [
"MVC-3.0"
],
},
"RootNamespace": "Kendo.Mvc.Examples",
"DisplayName": "Kendo.Mvc.Examples"
},
"ProjectWorkspaceState": {
"TagHelpers": [
Expand Down Expand Up @@ -159529,7 +159533,6 @@
],
"CSharpLanguageVersion": 1100
},
"RootNamespace": "Kendo.Mvc.Examples",
"Documents": [
{
"FilePath": "C:\\Program Files (x86)\\Progress\\Telerik UI for ASP.NET Core R1 2023\\wrappers\\aspnetcore\\Examples\\AspNet.Core\\VS2022\\Kendo.Mvc.Examples\\Views\\Linear_Gauge\\Scale_Options.cshtml",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"__Version": 6,
"ProjectKey": "C:\\Users\\admin\\location\\blazorserver\\obj\\Debug\\net7.0\\",
"FilePath": "C:\\Users\\admin\\location\\blazorserver\\blazorserver.csproj",
"Configuration": {
"ConfigurationName": "MVC-3.0",
"LanguageVersion": "3.0",
"Extensions": [ "MVC-3.0" ]
"__Version": 7,
"HostProject": {
"FilePath": "C:\\Users\\admin\\location\\blazorserver\\blazorserver.csproj",
"IntermediateOutputPath": "C:\\Users\\admin\\location\\blazorserver\\obj\\Debug\\net7.0\\",
"Configuration": {
"ConfigurationName": "MVC-3.0",
"LanguageVersion": "3.0",
"Extensions": [ "MVC-3.0" ]
},
"RootNamespace": "blazorserver",
"DisplayName": "blazorserver"
},
"ProjectWorkspaceState": {
"TagHelpers": [
Expand Down Expand Up @@ -16128,7 +16132,6 @@
],
"CSharpLanguageVersion": 800
},
"RootNamespace": "blazorserver",
"Documents": [
{
"FilePath": "C:\\Users\\admin\\location\\blazorserver\\Shared\\MainLayout.razor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ public void Deserialize_Json()

var projectInfo = DeserializeProjectInfo_Json(reader);

if (projectInfo.ProjectWorkspaceState is null ||
projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState?.TagHelpers.Length)
if (projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState.TagHelpers.Length)
{
throw new InvalidDataException();
}
Expand All @@ -93,8 +92,7 @@ public void RoundTrip_Json()

var projectInfo = DeserializeProjectInfo_Json(reader);

if (projectInfo.ProjectWorkspaceState is null ||
projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState?.TagHelpers.Length)
if (projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState.TagHelpers.Length)
{
throw new InvalidDataException();
}
Expand Down Expand Up @@ -132,8 +130,7 @@ public void Deserialize_MessagePack()
{
var projectInfo = DeserializeProjectInfo_MessagePack(_projectInfoMessagePackBytes);

if (projectInfo.ProjectWorkspaceState is null ||
projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState?.TagHelpers.Length)
if (projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState.TagHelpers.Length)
{
throw new InvalidDataException();
}
Expand All @@ -146,8 +143,7 @@ public void RoundTrip_MessagePack()
var projectInfo = DeserializeProjectInfo_MessagePack(bytes);
_buffer.Clear();

if (projectInfo.ProjectWorkspaceState is null ||
projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState?.TagHelpers.Length)
if (projectInfo.ProjectWorkspaceState.TagHelpers.Length != ProjectInfo.ProjectWorkspaceState.TagHelpers.Length)
{
throw new InvalidDataException();
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.ProjectSystem;
using Microsoft.AspNetCore.Razor.Serialization;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;

namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem;

Expand All @@ -19,21 +17,18 @@ internal readonly struct TestAccessor(RazorProjectService instance)
public ValueTask WaitForInitializationAsync()
=> instance.WaitForInitializationAsync();

public async Task<ProjectKey> AddProjectAsync(
string filePath,
string intermediateOutputPath,
RazorConfiguration? configuration,
string? rootNamespace,
string? displayName,
CancellationToken cancellationToken)
public async Task<ProjectKey> AddProjectAsync(HostProject hostProject, CancellationToken cancellationToken)
{
var service = instance;

await service.WaitForInitializationAsync().ConfigureAwait(false);
await instance.WaitForInitializationAsync().ConfigureAwait(false);

return await instance._projectManager
.UpdateAsync(
updater => service.AddProjectCore(updater, filePath, intermediateOutputPath, configuration, rootNamespace, displayName),
(updater, state) =>
{
var (service, hostProject) = state;
return service.AddProjectCore(updater, hostProject);
},
(instance, hostProject),
cancellationToken)
.ConfigureAwait(false);
}
Expand Down
Loading