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 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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