diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs index d8ab181d8d..0e40658d01 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs @@ -4,6 +4,7 @@ using System.Collections.Immutable; using System.IO; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.LanguageServer; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.Logging; @@ -53,6 +54,7 @@ public abstract partial class ProjectSnapshotManagerBenchmarkBase { return new ProjectSnapshotManager( projectEngineFactoryProvider: StaticProjectEngineFactoryProvider.Instance, + languageServerFeatureOptions: new DefaultLanguageServerFeatureOptions(), loggerFactory: EmptyLoggerFactory.Instance); } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs index 6b0c2f4396..c27bec7529 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs @@ -7,6 +7,7 @@ using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Xunit; @@ -49,12 +50,12 @@ public class ProjectEngineFactoryProviderTest : ToolingTestBase projectFilePath, intermediateOutputPath, new(RazorLanguageVersion.Version_2_1, "Random-0.1", Extensions: []), rootNamespace: null); - _snapshot_For_1_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_1_0, ProjectWorkspaceState.Default)); - _snapshot_For_1_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_1_1, ProjectWorkspaceState.Default)); - _snapshot_For_2_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_2_0, ProjectWorkspaceState.Default)); - _snapshot_For_2_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_2_1, ProjectWorkspaceState.Default)); - _snapshot_For_3_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_3_0, ProjectWorkspaceState.Default)); - _snapshot_For_UnknownConfiguration = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject_For_UnknownConfiguration, ProjectWorkspaceState.Default)); + _snapshot_For_1_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_1_0, ProjectWorkspaceState.Default)); + _snapshot_For_1_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_1_1, ProjectWorkspaceState.Default)); + _snapshot_For_2_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_2_0, ProjectWorkspaceState.Default)); + _snapshot_For_2_1 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_2_1, ProjectWorkspaceState.Default)); + _snapshot_For_3_0 = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_3_0, ProjectWorkspaceState.Default)); + _snapshot_For_UnknownConfiguration = new ProjectSnapshot(ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject_For_UnknownConfiguration, ProjectWorkspaceState.Default)); _customFactories = [ diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs index 72cdaffb7f..1d8a762a58 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs @@ -49,9 +49,10 @@ public abstract class LanguageServerTestBase : ToolingTestBase } private protected override TestProjectSnapshotManager CreateProjectSnapshotManager( - IProjectEngineFactoryProvider projectEngineFactoryProvider) + IProjectEngineFactoryProvider projectEngineFactoryProvider, LanguageServerFeatureOptions languageServerFeatureOptions) => new( projectEngineFactoryProvider, + languageServerFeatureOptions, LoggerFactory, DisposalToken, initializer: static updater => updater.ProjectAdded(MiscFilesHostProject.Instance)); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshot.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshot.cs index 731bf4a98d..b49cfd224f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshot.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshot.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.ProjectEngineHost; using Microsoft.AspNetCore.Razor.ProjectSystem; +using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -30,7 +31,7 @@ internal sealed class TestProjectSnapshot : IProjectSnapshot var hostProject = TestHostProject.Create(filePath); projectWorkspaceState ??= ProjectWorkspaceState.Default; - var state = ProjectState.Create(ProjectEngineFactories.DefaultProvider, hostProject, projectWorkspaceState); + var state = ProjectState.Create(ProjectEngineFactories.DefaultProvider, TestLanguageServerFeatureOptions.Instance, hostProject, projectWorkspaceState); return new TestProjectSnapshot(state); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshotManager.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshotManager.cs index 06ae213387..7d273a0e7c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshotManager.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestProjectSnapshotManager.cs @@ -7,15 +7,17 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.ProjectEngineHost; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Workspaces; namespace Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; internal partial class TestProjectSnapshotManager( IProjectEngineFactoryProvider projectEngineFactoryProvider, + LanguageServerFeatureOptions languageServerFeatureOptions, ILoggerFactory loggerFactory, CancellationToken disposalToken, Action? initializer = null) - : ProjectSnapshotManager(projectEngineFactoryProvider, loggerFactory, initializer) + : ProjectSnapshotManager(projectEngineFactoryProvider, languageServerFeatureOptions, loggerFactory, initializer) { private readonly CancellationToken _disposalToken = disposalToken; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs index 09d784274a..00ecb45319 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs @@ -8,7 +8,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.ProjectEngineHost; using Microsoft.AspNetCore.Razor.Test.Common.Logging; using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; +using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.VisualStudio.Threading; using Xunit; using Xunit.Abstractions; @@ -221,8 +223,12 @@ public abstract partial class ToolingTestBase : IAsyncLifetime => CreateProjectSnapshotManager(ProjectEngineFactories.DefaultProvider); private protected virtual TestProjectSnapshotManager CreateProjectSnapshotManager(IProjectEngineFactoryProvider projectEngineFactoryProvider) + => CreateProjectSnapshotManager(projectEngineFactoryProvider, TestLanguageServerFeatureOptions.Instance); + + private protected virtual TestProjectSnapshotManager CreateProjectSnapshotManager(IProjectEngineFactoryProvider projectEngineFactoryProvider, LanguageServerFeatureOptions languageServerFeatureOptions) => new( projectEngineFactoryProvider, + languageServerFeatureOptions, LoggerFactory, DisposalToken); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/DocumentExcerptServiceTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/DocumentExcerptServiceTestBase.cs index f013c6cab1..f156b67a39 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/DocumentExcerptServiceTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/DocumentExcerptServiceTestBase.cs @@ -42,7 +42,7 @@ public abstract class DocumentExcerptServiceTestBase(ITestOutputHelper testOutpu private (IDocumentSnapshot primary, Document secondary) InitializeDocument(SourceText sourceText) { var state = ProjectState - .Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create())); var project = new ProjectSnapshot(state); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/WorkspaceTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/WorkspaceTestBase.cs index fb683bd8fe..2fda7392cb 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/WorkspaceTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/WorkspaceTestBase.cs @@ -20,6 +20,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT private Workspace? _workspace; private IWorkspaceProvider? _workspaceProvider; private IProjectEngineFactoryProvider? _projectEngineFactoryProvider; + private LanguageServerFeatureOptions? _languageServerFeatureOptions; protected HostServices HostServices { @@ -57,8 +58,20 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT } } + private protected LanguageServerFeatureOptions LanguageServerFeatureOptions + { + get + { + EnsureInitialized(); + return _languageServerFeatureOptions; + } + } + private protected override TestProjectSnapshotManager CreateProjectSnapshotManager() - => CreateProjectSnapshotManager(ProjectEngineFactoryProvider); + => CreateProjectSnapshotManager(ProjectEngineFactoryProvider, LanguageServerFeatureOptions); + + private protected override TestProjectSnapshotManager CreateProjectSnapshotManager(IProjectEngineFactoryProvider projectEngineFactoryProvider) + => base.CreateProjectSnapshotManager(projectEngineFactoryProvider, LanguageServerFeatureOptions); protected virtual void ConfigureWorkspace(AdhocWorkspace workspace) { @@ -68,7 +81,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT { } - [MemberNotNull(nameof(_hostServices), nameof(_workspace), nameof(_workspaceProvider), nameof(_projectEngineFactoryProvider))] + [MemberNotNull(nameof(_hostServices), nameof(_workspace), nameof(_workspaceProvider), nameof(_projectEngineFactoryProvider), nameof(_languageServerFeatureOptions))] private void EnsureInitialized() { if (_initialized) @@ -77,6 +90,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT _workspace.AssumeNotNull(); _workspaceProvider.AssumeNotNull(); _projectEngineFactoryProvider.AssumeNotNull(); + _languageServerFeatureOptions.AssumeNotNull(); return; } @@ -89,6 +103,7 @@ public abstract class WorkspaceTestBase(ITestOutputHelper testOutput) : ToolingT _workspace = TestWorkspace.Create(_hostServices, ConfigureWorkspace); AddDisposable(_workspace); _workspaceProvider = new TestWorkspaceProvider(_workspace); + _languageServerFeatureOptions = TestLanguageServerFeatureOptions.Instance; _initialized = true; } diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultDocumentSnapshotTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultDocumentSnapshotTest.cs index 8fb1c912ad..9384e08a41 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultDocumentSnapshotTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultDocumentSnapshotTest.cs @@ -33,7 +33,7 @@ public class DefaultDocumentSnapshotTest : WorkspaceTestBase _sourceText = SourceText.From("

Hello World

"); _version = VersionStamp.Create(); - var projectState = ProjectState.Create(ProjectEngineFactoryProvider, TestProjectData.SomeProject, ProjectWorkspaceState.Default); + var projectState = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, TestProjectData.SomeProject, ProjectWorkspaceState.Default); var project = new ProjectSnapshot(projectState); var textLoader = TestMocks.CreateTextLoader(_sourceText, _version); diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs index 9cb9d299df..eb351a5d6f 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs @@ -44,7 +44,7 @@ public class DefaultProjectSnapshotTest : WorkspaceTestBase public void ProjectSnapshot_CachesDocumentSnapshots() { // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader); @@ -65,7 +65,7 @@ public class DefaultProjectSnapshotTest : WorkspaceTestBase public void GetRelatedDocuments_NonImportDocument_ReturnsEmpty() { // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader); var snapshot = new ProjectSnapshot(state); @@ -83,7 +83,7 @@ public class DefaultProjectSnapshotTest : WorkspaceTestBase public void GetRelatedDocuments_ImportDocument_ReturnsRelated() { // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader); diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedDocumentTextLoaderTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedDocumentTextLoaderTest.cs index edc944332d..be6725ad0d 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedDocumentTextLoaderTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/GeneratedDocumentTextLoaderTest.cs @@ -30,7 +30,7 @@ public class GeneratedDocumentTextLoaderTest : WorkspaceTestBase { // Arrange var project = new ProjectSnapshot( - ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader("", VersionStamp.Create()))); var document = project.GetDocument(_hostDocument.FilePath); diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateGeneratedOutputTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateGeneratedOutputTest.cs index 7e80b2537b..7dd40de184 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateGeneratedOutputTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateGeneratedOutputTest.cs @@ -43,7 +43,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = - ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader); var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken); @@ -62,7 +62,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = - ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader); var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken); @@ -82,7 +82,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = ProjectState - .Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader); @@ -104,7 +104,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = ProjectState - .Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader); @@ -126,7 +126,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = - ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader); @@ -147,7 +147,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = - ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader); var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken); @@ -168,7 +168,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = - ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader); var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken); @@ -192,7 +192,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase var hostProject = TestProjectData.SomeProject with { Configuration = csharp8ValidConfiguration }; var originalWorkspaceState = ProjectWorkspaceState.Create(_someTagHelpers, LanguageVersion.CSharp7); var original = - ProjectState.Create(ProjectEngineFactoryProvider, hostProject, originalWorkspaceState) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, hostProject, originalWorkspaceState) .WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader("@DateTime.Now", VersionStamp.Default)); var changedWorkspaceState = ProjectWorkspaceState.Create(_someTagHelpers, LanguageVersion.CSharp8); @@ -213,7 +213,7 @@ public class ProjectStateGeneratedOutputTest : WorkspaceTestBase { // Arrange var original = - ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, DocumentState.EmptyLoader); var (originalOutput, originalInputVersion) = await GetOutputAsync(original, _hostDocument, DisposalToken); diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs index 2658d89368..f1c3eb75ef 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs @@ -56,7 +56,7 @@ public class ProjectStateTest : WorkspaceTestBase public void GetImportDocumentTargetPaths_DoesNotIncludeCurrentImport() { // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); // Act var paths = state.GetImportDocumentTargetPaths(TestProjectData.SomeProjectComponentImportFile1); @@ -71,7 +71,7 @@ public class ProjectStateTest : WorkspaceTestBase // Arrange // Act - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); // Assert Assert.Empty(state.Documents); @@ -82,7 +82,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_AddHostDocument_ToEmpty() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); // Act var state = original.WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader); @@ -100,7 +100,7 @@ public class ProjectStateTest : WorkspaceTestBase public async Task ProjectState_AddHostDocument_DocumentIsEmpty() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); // Act var state = original.WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader); @@ -114,7 +114,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_AddHostDocument_ToProjectWithDocuments() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -138,7 +138,7 @@ public class ProjectStateTest : WorkspaceTestBase // Arrange // Act - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var state = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader) @@ -177,7 +177,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_AddHostDocument_TracksImports_AddImportFile() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader) @@ -220,7 +220,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_AddHostDocument_RetainsComputedState() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -253,7 +253,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_AddHostDocument_DuplicateNoops() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -268,7 +268,7 @@ public class ProjectStateTest : WorkspaceTestBase public async Task ProjectState_WithChangedHostDocument_Loader() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -288,7 +288,7 @@ public class ProjectStateTest : WorkspaceTestBase public async Task ProjectState_WithChangedHostDocument_Snapshot() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -308,7 +308,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithChangedHostDocument_Loader_RetainsComputedState() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -340,7 +340,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithChangedHostDocument_Snapshot_RetainsComputedState() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -372,7 +372,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithChangedHostDocument_Loader_NotFoundNoops() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -387,7 +387,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithChangedHostDocument_Snapshot_NotFoundNoops() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -402,7 +402,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_RemoveHostDocument_FromProjectWithDocuments() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -423,7 +423,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_RemoveHostDocument_TracksImports() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader) @@ -463,7 +463,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_RemoveHostDocument_TracksImports_RemoveAllDocuments() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectFile2, DocumentState.EmptyLoader) .WithAddedHostDocument(TestProjectData.SomeProjectNestedFile3, DocumentState.EmptyLoader) @@ -485,7 +485,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_RemoveHostDocument_RetainsComputedState() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -517,7 +517,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_RemoveHostDocument_NotFoundNoops() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -532,7 +532,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithHostProject_ConfigurationChange_UpdatesConfigurationState() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -570,7 +570,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithHostProject_RootNamespaceChange_UpdatesConfigurationState() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); var hostProjectWithRootNamespaceChange = original.HostProject with { RootNamespace = "ChangedRootNamespace" }; @@ -590,7 +590,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithHostProject_NoConfigurationChange_Noops() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -614,7 +614,7 @@ public class ProjectStateTest : WorkspaceTestBase documents[_documents[1].FilePath] = TestDocumentState.Create(_documents[1], onConfigurationChange: () => callCount++); documents[_documents[2].FilePath] = TestDocumentState.Create(_documents[2], onConfigurationChange: () => callCount++); - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original.Documents = documents.ToImmutable(); // Act @@ -630,7 +630,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithHostProject_ResetsImportedDocuments() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original = original.WithAddedHostDocument(TestProjectData.SomeProjectFile1, DocumentState.EmptyLoader); // Act @@ -646,7 +646,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithProjectWorkspaceState_Changed() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -685,7 +685,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithProjectWorkspaceState_Changed_TagHelpersChanged() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -719,7 +719,7 @@ public class ProjectStateTest : WorkspaceTestBase public void ProjectState_WithProjectWorkspaceState_IdenticalState_Caches() { // Arrange - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState) .WithAddedHostDocument(_documents[2], DocumentState.EmptyLoader) .WithAddedHostDocument(_documents[1], DocumentState.EmptyLoader); @@ -746,7 +746,7 @@ public class ProjectStateTest : WorkspaceTestBase documents[_documents[1].FilePath] = TestDocumentState.Create(_documents[1], onProjectWorkspaceStateChange: () => callCount++); documents[_documents[2].FilePath] = TestDocumentState.Create(_documents[2], onProjectWorkspaceStateChange: () => callCount++); - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original.Documents = documents.ToImmutable(); var changed = ProjectWorkspaceState.Default; @@ -790,7 +790,7 @@ public class ProjectStateTest : WorkspaceTestBase TestProjectData.SomeProjectNestedFile3.FilePath, TestProjectData.AnotherProjectNestedFile4.FilePath)); - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original.Documents = documents.ToImmutable(); original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable(); @@ -833,7 +833,7 @@ public class ProjectStateTest : WorkspaceTestBase TestProjectData.SomeProjectNestedFile3.FilePath, TestProjectData.AnotherProjectNestedFile4.FilePath)); - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original.Documents = documents.ToImmutable(); original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable(); @@ -879,7 +879,7 @@ public class ProjectStateTest : WorkspaceTestBase TestProjectData.SomeProjectNestedFile3.FilePath, TestProjectData.AnotherProjectNestedFile4.FilePath)); - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original.Documents = documents.ToImmutable(); original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable(); @@ -925,7 +925,7 @@ public class ProjectStateTest : WorkspaceTestBase TestProjectData.SomeProjectNestedFile3.FilePath, TestProjectData.AnotherProjectNestedFile4.FilePath)); - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original.Documents = documents.ToImmutable(); original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable(); @@ -971,7 +971,7 @@ public class ProjectStateTest : WorkspaceTestBase TestProjectData.SomeProjectNestedFile3.FilePath, TestProjectData.AnotherProjectNestedFile4.FilePath)); - var original = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState); + var original = ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, _projectWorkspaceState); original.Documents = documents.ToImmutable(); original.ImportsToRelatedDocuments = importsToRelatedDocuments.ToImmutable(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/DynamicFiles/RazorSpanMappingServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/DynamicFiles/RazorSpanMappingServiceTest.cs index b793ecc108..e578d1e9b6 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/DynamicFiles/RazorSpanMappingServiceTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/DynamicFiles/RazorSpanMappingServiceTest.cs @@ -30,7 +30,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa "); var project = new ProjectSnapshot(ProjectState - .Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create()))); var document = project.GetDocument(_hostDocument.FilePath); @@ -62,7 +62,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa "); var project = new ProjectSnapshot(ProjectState - .Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create()))); var document = project.GetDocument(_hostDocument.FilePath); @@ -95,7 +95,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa "); var project = new ProjectSnapshot(ProjectState - .Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create()))); var document = project.GetDocument(_hostDocument.FilePath); @@ -127,7 +127,7 @@ public class RazorSpanMappingServiceTest(ITestOutputHelper testOutput) : Workspa "); var project = new ProjectSnapshot(ProjectState - .Create(ProjectEngineFactoryProvider, _hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, _hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(_hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create()))); var document = project.GetDocument(_hostDocument.FilePath); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorDocumentOptionsServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorDocumentOptionsServiceTest.cs index 9e6c078dd9..2f0c004286 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorDocumentOptionsServiceTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorDocumentOptionsServiceTest.cs @@ -97,7 +97,7 @@ public class RazorDocumentOptionsServiceTest(ITestOutputHelper testOutput) : Wor Path.Combine(baseDirectory, "SomeProject", "File1.cshtml"), "File1.cshtml", FileKinds.Legacy); var project = new ProjectSnapshot(ProjectState - .Create(ProjectEngineFactoryProvider, hostProject, ProjectWorkspaceState.Default) + .Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, hostProject, ProjectWorkspaceState.Default) .WithAddedHostDocument(hostDocument, TestMocks.CreateTextLoader(sourceText, VersionStamp.Create()))); var documentSnapshot = project.GetDocument(hostDocument.FilePath); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultWindowsRazorProjectHostTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultWindowsRazorProjectHostTest.cs index 99ebb5d5cc..eb8c5cb1bd 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultWindowsRazorProjectHostTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultWindowsRazorProjectHostTest.cs @@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common.VisualStudio; -using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.VisualStudio.ProjectSystem.Properties; using Xunit; using Xunit.Abstractions; @@ -451,7 +450,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase var projectState = new Dictionary().ToImmutableDictionary(); // Act - var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration); + var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration); // Assert Assert.False(result); @@ -473,7 +472,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }.ToImmutableDictionary(); // Act - var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration); + var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration); // Assert Assert.False(result); @@ -496,7 +495,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }.ToImmutableDictionary(); // Act - var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration); + var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration); // Assert Assert.False(result); @@ -525,7 +524,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }.ToImmutableDictionary(); // Act - var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration); + var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration); // Assert Assert.True(result); @@ -559,7 +558,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }.ToImmutableDictionary(); // Act - var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration); + var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration); // Assert Assert.True(result); @@ -607,7 +606,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }.ToImmutableDictionary(); // Act - var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, languageServerFlags: null, out var configuration); + var result = DefaultWindowsRazorProjectHost.TryGetConfiguration(projectState, out var configuration); // Assert Assert.True(result); @@ -624,7 +623,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase { // Arrange var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); // Act & Assert await host.LoadAsync(); @@ -639,7 +638,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase { // Arrange var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); // Act & Assert await Task.Run(async () => await host.LoadAsync()); @@ -658,7 +657,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }; var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); // Act & Assert await Task.Run(async () => await host.LoadAsync()); @@ -702,7 +701,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); host.SkipIntermediateOutputPathExistCheck_TestOnly = true; await Task.Run(async () => await host.LoadAsync()); @@ -755,7 +754,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase public void IntermediateOutputPathCalculationHandlesRelativePaths(string baseIntermediateOutputPath, string intermediateOutputPath, string expectedCombinedIOP) { var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); var state = TestProjectRuleSnapshot.CreateProperties( WindowsRazorProjectHostBase.ConfigurationGeneralSchemaName, @@ -798,7 +797,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }; var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); await Task.Run(async () => await host.LoadAsync()); Assert.Empty(_projectManager.GetProjects()); @@ -849,7 +848,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }; var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); host.SkipIntermediateOutputPathExistCheck_TestOnly = true; await Task.Run(async () => await host.LoadAsync()); @@ -903,7 +902,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }; var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); host.SkipIntermediateOutputPathExistCheck_TestOnly = true; await Task.Run(async () => await host.LoadAsync()); @@ -1059,7 +1058,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }; var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); host.SkipIntermediateOutputPathExistCheck_TestOnly = true; await Task.Run(async () => await host.LoadAsync()); @@ -1134,7 +1133,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }; var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); host.SkipIntermediateOutputPathExistCheck_TestOnly = true; await Task.Run(async () => await host.LoadAsync()); @@ -1214,7 +1213,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); host.SkipIntermediateOutputPathExistCheck_TestOnly = true; await Task.Run(async () => await host.LoadAsync()); @@ -1311,7 +1310,7 @@ public class DefaultWindowsRazorProjectHostTest : VisualStudioWorkspaceTestBase }; var services = new TestProjectSystemServices(TestProjectData.SomeProject.FilePath); - var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager, languageServerFeatureOptions: new TestLanguageServerFeatureOptions()); + var host = new DefaultWindowsRazorProjectHost(services, _serviceProvider, _projectManager); host.SkipIntermediateOutputPathExistCheck_TestOnly = true; await Task.Run(async () => await host.LoadAsync()); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackProjectManagerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackProjectManagerTest.cs index 43c28f4e8d..57d07c5b99 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackProjectManagerTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackProjectManagerTest.cs @@ -39,7 +39,6 @@ public class FallbackProjectManagerTest : VisualStudioWorkspaceTestBase _fallbackProjectManger = new FallbackProjectManager( serviceProvider, - languageServerFeatureOptions, _projectManager, WorkspaceProvider, NoOpTelemetryReporter.Instance); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/RazorDynamicFileInfoProviderTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/RazorDynamicFileInfoProviderTest.cs index d749db5e6a..ff1fa77965 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/RazorDynamicFileInfoProviderTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/RazorDynamicFileInfoProviderTest.cs @@ -73,7 +73,6 @@ public class RazorDynamicFileInfoProviderTest(ITestOutputHelper testOutput) : Vi var fallbackProjectManager = new FallbackProjectManager( serviceProvider, - languageServerFeatureOptions, _projectManager, WorkspaceProvider, NoOpTelemetryReporter.Instance); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectWorkspaceStateGeneratorTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectWorkspaceStateGeneratorTest.cs index ac3cc9ee05..c1dca22323 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectWorkspaceStateGeneratorTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectWorkspaceStateGeneratorTest.cs @@ -42,7 +42,7 @@ public class ProjectWorkspaceStateGeneratorTest : VisualStudioWorkspaceTestBase TestProjectData.SomeProject.FilePath)); _workspaceProject = solution.GetProject(projectId).AssumeNotNull(); _projectSnapshot = new ProjectSnapshot( - ProjectState.Create(ProjectEngineFactoryProvider, TestProjectData.SomeProject, ProjectWorkspaceState.Default)); + ProjectState.Create(ProjectEngineFactoryProvider, LanguageServerFeatureOptions, TestProjectData.SomeProject, ProjectWorkspaceState.Default)); _projectWorkspaceStateWithTagHelpers = ProjectWorkspaceState.Create( [TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly").Build()]);