Move shared contained language test helpers into Test.Common.Tooling

This commit is contained in:
Dustin Campbell 2023-11-15 15:19:03 -08:00
Родитель cf7e4852eb
Коммит c1e84e321d
27 изменённых файлов: 49 добавлений и 129 удалений

Просмотреть файл

@ -58,8 +58,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Lang
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test", "src\Razor\test\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.csproj", "{0FC409AF-B92B-42D0-9096-1F20360D2672}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common", "src\Razor\test\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common.csproj", "{1C7BBF16-3507-4A23-91B4-9EEA03409C72}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.Razor.Test", "src\Razor\test\Microsoft.CodeAnalysis.Remote.Razor.Test\Microsoft.CodeAnalysis.Remote.Razor.Test.csproj", "{39233703-B752-43AC-AD86-E9D3E61B4AD9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.Razor.CoreComponents", "src\Razor\src\Microsoft.CodeAnalysis.Remote.Razor.CoreComponents\Microsoft.CodeAnalysis.Remote.Razor.CoreComponents.csproj", "{17C4A6DF-3AA5-43FE-8A0E-53DF14340446}"
@ -367,14 +365,6 @@ Global
{0FC409AF-B92B-42D0-9096-1F20360D2672}.Release|Any CPU.Build.0 = Release|Any CPU
{0FC409AF-B92B-42D0-9096-1F20360D2672}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{0FC409AF-B92B-42D0-9096-1F20360D2672}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.Release|Any CPU.Build.0 = Release|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{1C7BBF16-3507-4A23-91B4-9EEA03409C72}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{39233703-B752-43AC-AD86-E9D3E61B4AD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39233703-B752-43AC-AD86-E9D3E61B4AD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39233703-B752-43AC-AD86-E9D3E61B4AD9}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
@ -747,7 +737,6 @@ Global
{35FEC0EA-09B5-45D2-832D-D6FEBA364871} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{0D6FD2CD-3C0A-452B-AC12-DE6301C287AC} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{0FC409AF-B92B-42D0-9096-1F20360D2672} = {92463391-81BE-462B-AC3C-78C6C760741F}
{1C7BBF16-3507-4A23-91B4-9EEA03409C72} = {92463391-81BE-462B-AC3C-78C6C760741F}
{39233703-B752-43AC-AD86-E9D3E61B4AD9} = {92463391-81BE-462B-AC3C-78C6C760741F}
{17C4A6DF-3AA5-43FE-8A0E-53DF14340446} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{8CEC0991-259F-4313-B3EF-E398F2B40E61} = {92463391-81BE-462B-AC3C-78C6C760741F}

Просмотреть файл

@ -2,6 +2,7 @@
// Licensed under the MIT license. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

Просмотреть файл

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(DefaultNetCoreTargetFrameworks);$(DefaultNetFxTargetFramework)</TargetFrameworks>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup>
<Using Alias="Range" Include="Microsoft.VisualStudio.LanguageServer.Protocol.Range" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.LanguageServer\Microsoft.AspNetCore.Razor.LanguageServer.csproj" />
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor.Workspaces\Microsoft.CodeAnalysis.Razor.Workspaces.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common.Tooling\Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,10 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.
#nullable disable
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServerClient.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

Просмотреть файл

@ -5,12 +5,12 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
using Microsoft.VisualStudio.Text;
namespace Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
namespace Microsoft.AspNetCore.Razor.Test.Common.Editor;
public class TestLSPDocumentSnapshot : LSPDocumentSnapshot
internal class TestLSPDocumentSnapshot : LSPDocumentSnapshot
{
public TestLSPDocumentSnapshot(Uri uri, int version, params VirtualDocumentSnapshot[] virtualDocuments)
: this(uri, version, snapshotContent: "Hello World", virtualDocuments)

Просмотреть файл

@ -1,10 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
using Microsoft.VisualStudio.Text;
using System;
namespace Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common;
namespace Microsoft.AspNetCore.Razor.Test.Common.Editor;
internal class TestVirtualDocument : VirtualDocumentBase<TestVirtualDocumentSnapshot>
{

Просмотреть файл

@ -4,11 +4,12 @@
#nullable disable
using System;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
using Microsoft.VisualStudio.Text;
namespace Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
namespace Microsoft.AspNetCore.Razor.Test.Common.Editor;
public class TestVirtualDocumentSnapshot : VirtualDocumentSnapshot
internal class TestVirtualDocumentSnapshot : VirtualDocumentSnapshot
{
private readonly long? _hostDocumentSyncVersion;

Просмотреть файл

@ -63,6 +63,7 @@
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
<PackageReference Include="Microsoft.VisualStudio.Language.Intellisense" Version="$(MicrosoftVisualStudioLanguageIntellisensePackageVersion)" />
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.Editor.Razor\Microsoft.VisualStudio.Editor.Razor.csproj" />
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.LanguageServer.ContainedLanguage\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.csproj" />
<Reference Include="WindowsBase" />
</ItemGroup>

Просмотреть файл

@ -15,8 +15,9 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServerClient.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Razor.IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]

Просмотреть файл

@ -8,7 +8,6 @@ using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Razor;
using Microsoft.CodeAnalysis.Razor.Editor;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
@ -33,7 +32,7 @@ public class DefaultRazorDocumentManagerTest : ProjectSnapshotManagerDispatcherT
private readonly WorkspaceEditorSettings _workspaceEditorSettings;
private readonly ImportDocumentManager _importDocumentManager;
private readonly Workspace _workspace;
private readonly CodeAnalysis.Workspace _workspace;
public DefaultRazorDocumentManagerTest(ITestOutputHelper testOutput)
: base(testOutput)

Просмотреть файл

@ -5,7 +5,6 @@
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Razor;
using Microsoft.VisualStudio.Text;
@ -68,7 +67,7 @@ public class DefaultRazorEditorFactoryServiceTest : ToolingTestBase
public void TryInitializeTextBuffer_WorkspaceAccessorCanNotAccessWorkspace_ReturnsFalse()
{
// Arrange
Workspace workspace = null;
CodeAnalysis.Workspace workspace = null;
var workspaceAccessor = new Mock<VisualStudioWorkspaceAccessor>(MockBehavior.Strict);
workspaceAccessor.Setup(provider => provider.TryGetWorkspace(It.IsAny<ITextBuffer>(), out workspace))
.Returns(false);
@ -278,7 +277,7 @@ public class DefaultRazorEditorFactoryServiceTest : ToolingTestBase
smartIndenterFactory
});
Workspace workspace = TestWorkspace.Create(services);
CodeAnalysis.Workspace workspace = TestWorkspace.Create(services);
var workspaceAccessor = new Mock<VisualStudioWorkspaceAccessor>(MockBehavior.Strict);
workspaceAccessor.Setup(p => p.TryGetWorkspace(It.IsAny<ITextBuffer>(), out workspace))
.Returns(true);

Просмотреть файл

@ -9,7 +9,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Razor;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
using Moq;
@ -22,7 +21,7 @@ public class DefaultVisualStudioRazorParserTest : ProjectSnapshotManagerDispatch
{
private readonly IProjectSnapshot _projectSnapshot;
private readonly ProjectSnapshotProjectEngineFactory _projectEngineFactory;
private readonly Workspace _workspace;
private readonly CodeAnalysis.Workspace _workspace;
public DefaultVisualStudioRazorParserTest(ITestOutputHelper testOutput)
: base(testOutput)

Просмотреть файл

@ -1,41 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
namespace Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common.Extensions;
internal static class SourceTextExtensions
{
public static void GetLinesAndOffsets(
this SourceText sourceText,
Span span,
out int startLineNumber,
out int startOffset,
out int endLineNumber,
out int endOffset)
{
if (sourceText is null)
{
throw new ArgumentNullException(nameof(sourceText));
}
sourceText.GetLineAndOffset(span.Start, out startLineNumber, out startOffset);
sourceText.GetLineAndOffset(span.End, out endLineNumber, out endOffset);
}
public static void GetLineAndOffset(this SourceText source, int position, out int lineNumber, out int offset)
{
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
var line = source.Lines.GetLineFromPosition(position);
lineNumber = line.LineNumber;
offset = position - line.Start;
}
}

Просмотреть файл

@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(DefaultNetFxTargetFramework)</TargetFrameworks>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.LanguageServer.ContainedLanguage\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common.Tooling\Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,8 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.
#nullable disable
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServerClient.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

Просмотреть файл

@ -5,6 +5,7 @@
using System;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.VisualStudio.Text.Editor;
using Moq;
using Xunit;

Просмотреть файл

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
using Moq;

Просмотреть файл

@ -5,7 +5,7 @@
using System;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
using Moq;

Просмотреть файл

@ -14,7 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.LanguageServer.ContainedLanguage\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.csproj" />
<ProjectReference Include="..\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common.Tooling\Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -7,7 +7,6 @@ using System;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Extensions;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common;
using Microsoft.VisualStudio.Text;
using Xunit;
using Xunit.Abstractions;

Просмотреть файл

@ -7,7 +7,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
using Moq;

Просмотреть файл

@ -5,6 +5,7 @@
using System;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.CodeAnalysis.Razor.Workspaces;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
using Microsoft.VisualStudio.LanguageServerClient.Razor.DocumentMapping;

Просмотреть файл

@ -14,7 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.LanguageServerClient.Razor\Microsoft.VisualStudio.LanguageServerClient.Razor.csproj" />
<ProjectReference Include="..\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common\Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common.Tooling\Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -7,10 +7,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Razor.Telemetry;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage.Test.Common.Extensions;
using Microsoft.VisualStudio.Text;
namespace Microsoft.VisualStudio.LanguageServerClient.Razor.Test;
@ -71,8 +71,8 @@ internal class TestDocumentManager(CSharpTestLspServer testLspServer = null) : T
var virtualSourceText = SourceText.From(virtualDocumentSnapshot.Snapshot.GetText());
var rangesAndTexts = changes.Select(c =>
{
virtualSourceText.GetLinesAndOffsets(c.OldSpan, out var startLine, out var startCharacter, out var endLine, out var endCharacter);
var range = new LanguageServer.Protocol.Range
GetLinesAndOffsets(virtualSourceText, c.OldSpan, out var startLine, out var startCharacter, out var endLine, out var endCharacter);
var range = new Range
{
Start = new LanguageServer.Protocol.Position { Line = startLine, Character = startCharacter },
End = new LanguageServer.Protocol.Position { Line = endLine, Character = endCharacter }
@ -85,4 +85,23 @@ internal class TestDocumentManager(CSharpTestLspServer testLspServer = null) : T
_testLspServer.ReplaceTextAsync(virtualDocumentSnapshot.Uri, rangesAndTexts).Wait();
#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits
}
private static void GetLinesAndOffsets(
SourceText sourceText,
Span span,
out int startLineNumber,
out int startOffset,
out int endLineNumber,
out int endOffset)
{
(startLineNumber, startOffset) = GetLineAndOffset(sourceText, span.Start);
(endLineNumber, endOffset) = GetLineAndOffset(sourceText, span.End);
static (int lineNumber, int offset) GetLineAndOffset(SourceText source, int position)
{
var line = source.Lines.GetLineFromPosition(position);
return (lineNumber: line.LineNumber, offset: position - line.Start);
}
}
}

Просмотреть файл

@ -7,7 +7,6 @@ using System;
using System.Collections.ObjectModel;
using Microsoft.AspNetCore.Razor.Test.Common;
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.Editor.Razor;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Projection;
@ -135,7 +134,7 @@ public class DefaultVisualStudioWorkspaceAccessorTest : ToolingTestBase
_canGetWorkspaceFromHostProject = canGetWorkspaceFromHostProject;
}
internal override bool TryGetWorkspaceFromProjectionBuffer(ITextBuffer textBuffer, out Workspace workspace)
internal override bool TryGetWorkspaceFromProjectionBuffer(ITextBuffer textBuffer, out CodeAnalysis.Workspace workspace)
{
if (_canGetWorkspaceFromProjectionBuffer)
{
@ -147,7 +146,7 @@ public class DefaultVisualStudioWorkspaceAccessorTest : ToolingTestBase
return false;
}
internal override bool TryGetWorkspaceFromHostProject(ITextBuffer textBuffer, out Workspace workspace)
internal override bool TryGetWorkspaceFromHostProject(ITextBuffer textBuffer, out CodeAnalysis.Workspace workspace)
{
if (_canGetWorkspaceFromHostProject)
{

Просмотреть файл

@ -31,7 +31,7 @@ public class VsSolutionUpdatesProjectSnapshotChangeTriggerTest : ToolingTestBase
private readonly HostProject _someProject;
private readonly HostProject _someOtherProject;
private Project _someWorkspaceProject;
private readonly Workspace _workspace;
private readonly CodeAnalysis.Workspace _workspace;
public VsSolutionUpdatesProjectSnapshotChangeTriggerTest(ITestOutputHelper testOutput)
: base(testOutput)

Просмотреть файл

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.ProjectSystem;
using Microsoft.AspNetCore.Razor.Test.Common.Editor;
using Microsoft.AspNetCore.Razor.Test.Common.Workspaces;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
using Microsoft.VisualStudio.LiveShare.Razor.Test;
using Microsoft.VisualStudio.Threading;
@ -21,7 +20,7 @@ namespace Microsoft.VisualStudio.LiveShare.Razor.Host;
public class DefaultProjectSnapshotManagerProxyTest : ProjectSnapshotManagerDispatcherTestBase
{
private readonly Workspace _workspace;
private readonly CodeAnalysis.Workspace _workspace;
private readonly IProjectSnapshot _projectSnapshot1;
private readonly IProjectSnapshot _projectSnapshot2;