提交 b5bfb8d2 编写于 作者: H Heejae Chang 提交者: GitHub

Merge pull request #14043 from heejaechang/remotehostworkspace

move RemoteHost down to workspace layer
......@@ -361,8 +361,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RepoUtil", "src\Tools\RepoU
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildTask", "src\Compilers\Core\MSBuildTask\MSBuildTask.csproj", "{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioTestUtilities.Next", "src\VisualStudio\TestUtilities.Next\VisualStudioTestUtilities.Next.csproj", "{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteHostClientMock", "src\VisualStudio\RemoteHostClientMock\RemoteHostClientMock.csproj", "{7259740A-FD0E-480F-A7D4-08BE90AC9051}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicesVisualStudio.Next", "src\VisualStudio\Core\Next\ServicesVisualStudio.Next.csproj", "{FE0D4BDD-1C30-488E-A870-854F5B8C5014}"
......@@ -3122,26 +3120,6 @@ Global
{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|x64.Build.0 = Release|Any CPU
{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|x86.ActiveCfg = Release|Any CPU
{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|x86.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|ARM.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x64.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x64.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x86.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x86.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Any CPU.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|ARM.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|ARM.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x64.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x64.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x86.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x86.Build.0 = Release|Any CPU
{7259740A-FD0E-480F-A7D4-08BE90AC9051}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7259740A-FD0E-480F-A7D4-08BE90AC9051}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7259740A-FD0E-480F-A7D4-08BE90AC9051}.Debug|ARM.ActiveCfg = Debug|Any CPU
......@@ -3368,7 +3346,6 @@ Global
{80FDDD00-9393-47F7-8BAF-7E87CE011068} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{1CA184D3-89CB-4074-BEC5-F8AEBA657D41} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9}
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{7259740A-FD0E-480F-A7D4-08BE90AC9051} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{FE0D4BDD-1C30-488E-A870-854F5B8C5014} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{2E1658E2-5045-4F85-A64C-C0ECCD39F719} = {8DBA5174-B0AA-4561-82B1-A46607697753}
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
extern alias hub;
using System;
using System.Diagnostics;
using System.IO;
......@@ -16,7 +14,7 @@
using Roslyn.Utilities;
using StreamJsonRpc;
namespace Roslyn.VisualStudio.Test.Utilities.Remote
namespace Roslyn.Test.Utilities.Remote
{
internal class InProcRemoteHostClient : RemoteHostClient
{
......@@ -61,7 +59,7 @@ protected override async Task<Session> CreateServiceSessionAsync(string serviceN
{
// get stream from service hub to communicate snapshot/asset related information
// this is the back channel the system uses to move data between VS and remote host
var snapshotStream = await _inprocServices.RequestServiceAsync(hub::Microsoft.CodeAnalysis.Remote.WellKnownServiceHubServices.SnapshotService, cancellationToken).ConfigureAwait(false);
var snapshotStream = await _inprocServices.RequestServiceAsync(WellKnownServiceHubServices.SnapshotService, cancellationToken).ConfigureAwait(false);
// get stream from service hub to communicate service specific information
// this is what consumer actually use to communicate information
......@@ -102,12 +100,12 @@ public Task<Stream> RequestServiceAsync(string serviceName, CancellationToken ca
var tuple = FullDuplexStream.CreateStreams();
return Task.FromResult<Stream>(new WrappedStream(new RemoteHostService(tuple.Item1, s_serviceProvider), tuple.Item2));
}
case hub::Microsoft.CodeAnalysis.Remote.WellKnownServiceHubServices.CodeAnalysisService:
case WellKnownServiceHubServices.CodeAnalysisService:
{
var tuple = FullDuplexStream.CreateStreams();
return Task.FromResult<Stream>(new WrappedStream(new CodeAnalysisService(tuple.Item1, s_serviceProvider), tuple.Item2));
}
case hub::Microsoft.CodeAnalysis.Remote.WellKnownServiceHubServices.SnapshotService:
case WellKnownServiceHubServices.SnapshotService:
{
var tuple = FullDuplexStream.CreateStreams();
return Task.FromResult<Stream>(new WrappedStream(new SnapshotService(tuple.Item1, s_serviceProvider), tuple.Item2));
......
......@@ -41,6 +41,10 @@
<Project>{5f8d2414-064a-4b3a-9b42-8e2a04246be5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Remote\ServiceHub\ServiceHub.csproj">
<Project>{80fddd00-9393-47f7-8baf-7e87ce011068}</Project>
<Name>ServiceHub</Name>
</ProjectReference>
<ProjectReference Include="..\Core\EditorFeatures.csproj">
<Project>{3CDEEAB7-2256-418A-BEB2-620B5CB16302}</Project>
<Name>EditorFeatures</Name>
......@@ -59,6 +63,12 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\visualstudio\core\next\remote\JsonRpcClient.cs">
<Link>Remote\JsonRpcClient.cs</Link>
</Compile>
<Compile Include="..\..\visualstudio\core\next\remote\JsonRpcSession.cs">
<Link>Remote\JsonRpcSession.cs</Link>
</Compile>
<Compile Include="Async\AsynchronousOperationBlocker.cs" />
<Compile Include="Async\Checkpoint.cs" />
<Compile Include="Async\WaitHelper.cs" />
......@@ -66,6 +76,7 @@
<Compile Include="DispatcherExtensions.cs" />
<Compile Include="DirectoryExtensions.cs" />
<Compile Include="ExceptionUtilities.cs" />
<Compile Include="Remote\InProcRemostHostClient.cs" />
<Compile Include="Threading\ConditionalWpfFactAttribute.cs" />
<Compile Include="Threading\StaTaskScheduler.cs" />
<Compile Include="Threading\WpfFactAttribute.cs" />
......@@ -75,6 +86,7 @@
<Compile Include="VisualStudioSendKeys.cs" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Roslyn.VisualStudio.RemoteHostClientMock" />
<InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.CommandLine.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Emit.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.EnC.UnitTests" />
......@@ -93,10 +105,11 @@
<InternalsVisibleToTest Include="Roslyn.InteractiveHost.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.Editor.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Utilities" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<Import Project="..\..\..\build\Targets\VSL.Imports.targets" />
<Import Project="..\..\..\build\Targets\Roslyn.Toolsets.Xunit.targets" />
</Project>
</Project>
\ No newline at end of file
{
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.console": "2.2.0-beta1-build3239"
},
"frameworks": {
"net46": { }
}
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.console": "2.2.0-beta1-build3239",
"Newtonsoft.Json": "8.0.3",
"Nerdbank.FullDuplexStream": "1.0.1"
},
"frameworks": {
"net46": { }
}
}
\ No newline at end of file
......@@ -7,9 +7,9 @@
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Diagnostics.EngineV2;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Workspaces.Diagnostics;
using Microsoft.VisualStudio.LanguageServices.Diagnostics;
using Microsoft.VisualStudio.LanguageServices.Remote;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics
{
......
......@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.ComponentModel.Design;
using Microsoft.CodeAnalysis.Packaging;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.SymbolSearch;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
......
......@@ -9,6 +9,7 @@
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Execution;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Shell.Interop;
......
......@@ -6,6 +6,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Execution;
using Microsoft.CodeAnalysis.Notification;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
......
......@@ -4,6 +4,7 @@
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.VisualStudio.LanguageServices.Remote
......
......@@ -109,14 +109,10 @@
<Compile Include="Implementation\Extensions\VisualStudioWorkspaceImplExtensions.cs" />
<Compile Include="Implementation\Options\LanguageSettingsPersister.cs" />
<Compile Include="Implementation\ProjectSystem\Interop\IVsUndoState.cs" />
<Compile Include="Implementation\Remote\IRemoteHostClientFactory.cs" />
<Compile Include="Implementation\Remote\IRemoteHostClientService.cs" />
<Compile Include="Implementation\Remote\RemoteHostClient.cs" />
<Compile Include="Implementation\Remote\RemoteHostClientServiceFactory.cs" />
<Compile Include="Implementation\Remote\RemoteHostClientServiceFactory.RemoteHostClientService.cs" />
<Compile Include="Implementation\Remote\RemoteHostClientServiceFactory.SolutionChecksumUpdater.cs" />
<Compile Include="Implementation\Remote\RemoteHostOptions.cs" />
<Compile Include="Implementation\Remote\WellKnownRemoteHostServices.cs" />
<Compile Include="Implementation\Serialization\AssemblySerializationInfoService.cs" />
<Compile Include="Implementation\TableDataSource\DiagnosticTableControlEventProcessorProvider.AggregateDiagnosticTableControlEventProcessor.cs" />
<Compile Include="Implementation\TableDataSource\Suppression\IVisualStudioDiagnosticListSuppressionStateService.cs" />
......@@ -286,7 +282,6 @@
<InternalsVisibleToTest Include="RoslynETAHost" />
<InternalsVisibleToTest Include="RoslynTaoActions" />
<InternalsVisibleToTest Include="Microsoft.VisualStudio.ErrorList.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Utilities.Next" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
<InternalsVisibleToMoq Include="DynamicProxyGenAssembly2" />
<InternalsVisibleToTypeScript Include="Microsoft.VisualStudio.Alm.Shared.CodeAnalysisClient" />
......
......@@ -4,19 +4,17 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.VisualStudio.LanguageServices.Remote;
using static Microsoft.VisualStudio.LanguageServices.Remote.RemoteHostClient;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Extensions
{
internal static class RemoteHostClientExtensions
{
public static Task<Session> CreateCodeAnalysisServiceSessionAsync(this RemoteHostClient client, Solution solution, CancellationToken cancellationToken)
public static Task<RemoteHostClient.Session> CreateCodeAnalysisServiceSessionAsync(this RemoteHostClient client, Solution solution, CancellationToken cancellationToken)
{
return CreateCodeAnalysisServiceSessionAsync(client, solution, callbackTarget: null, cancellationToken: cancellationToken);
}
public static Task<Session> CreateCodeAnalysisServiceSessionAsync(this RemoteHostClient client, Solution solution, object callbackTarget, CancellationToken cancellationToken)
public static Task<RemoteHostClient.Session> CreateCodeAnalysisServiceSessionAsync(this RemoteHostClient client, Solution solution, object callbackTarget, CancellationToken cancellationToken)
{
return client.CreateServiceSessionAsync(WellKnownServiceHubServices.CodeAnalysisService, solution, callbackTarget, cancellationToken);
}
......
......@@ -4,6 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Host.Mef;
using Roslyn.Utilities;
......
......@@ -127,7 +127,6 @@
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.TestImpact.BuildManager" />
<InternalsVisibleTo Include="Roslyn.VisualStudio.RemoteHostClientMock" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Utilities.Next" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
</ItemGroup>
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
......
......@@ -89,10 +89,6 @@
<Name>Features</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\TestUtilities.Next\VisualStudioTestUtilities.Next.csproj">
<Project>{78324e87-92d5-412c-9fa8-5cc2fbfbaf6c}</Project>
<Name>VisualStudioTestUtilities.Next</Name>
</ProjectReference>
<ProjectReference Include="..\Next\ServicesVisualStudio.Next.csproj">
<Project>{fe0d4bdd-1c30-488e-a870-854f5b8c5014}</Project>
<Name>ServicesVisualStudio.Next</Name>
......
......@@ -4,9 +4,10 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Remote;
using Roslyn.VisualStudio.Test.Utilities.Remote;
using Roslyn.Test.Utilities.Remote;
namespace Roslyn.VisualStudio.DiagnosticsWindow.Remote
{
......
......@@ -25,6 +25,10 @@
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\EditorFeatures\TestUtilities\ServicesTestUtilities.csproj">
<Project>{76c6f005-c89d-4348-bb4a-39189ddbeb52}</Project>
<Name>ServicesTestUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\VisualStudio\Core\Def\ServicesVisualStudio.csproj">
<Project>{86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}</Project>
<Name>ServicesVisualStudio</Name>
......@@ -50,12 +54,6 @@
<Project>{fe0d4bdd-1c30-488e-a870-854f5b8c5014}</Project>
<Name>ServicesVisualStudio.Next</Name>
</ProjectReference>
<ProjectReference Include="..\TestUtilities.Next\VisualStudioTestUtilities.Next.csproj">
<Project>{78324e87-92d5-412c-9fa8-5cc2fbfbaf6c}</Project>
<Name>VisualStudioTestUtilities.Next</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<NuGetPackageToIncludeInVsix Include="Nerdbank.FullDuplexStream" />
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\build\Targets\VSL.Settings.targets" />
<PropertyGroup>
<ProjectGuid>{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Roslyn.VisualStudio.Test.Utilities</RootNamespace>
<AssemblyName>Roslyn.VisualStudio.Test.Utilities.Next</AssemblyName>
<PlatformTarget>x86</PlatformTarget>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<Nonshipping>true</Nonshipping>
</PropertyGroup>
<PropertyGroup>
<IncludeFrameworkReferencesFromNuGet>false</IncludeFrameworkReferencesFromNuGet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="Remote\InProcRemostHostClient.cs" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Roslyn.VisualStudio.RemoteHostClientMock" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5f8d2414-064a-4b3a-9b42-8e2a04246be5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Remote\ServiceHub\ServiceHub.csproj">
<Project>{80fddd00-9393-47f7-8baf-7e87ce011068}</Project>
<Name>ServiceHub</Name>
<Aliases>global,hub</Aliases>
</ProjectReference>
<ProjectReference Include="..\Core\Def\ServicesVisualStudio.csproj">
<Project>{86fd5b9a-4fa0-4b10-b59f-cfaf077a859c}</Project>
<Name>ServicesVisualStudio</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\Core\Next\ServicesVisualStudio.Next.csproj">
<Project>{fe0d4bdd-1c30-488e-a870-854f5b8c5014}</Project>
<Name>ServicesVisualStudio.Next</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="..\..\..\build\Targets\VSL.Imports.targets" />
</Project>
\ No newline at end of file
{
"dependencies": {
"Newtonsoft.Json": "8.0.3",
"Nerdbank.FullDuplexStream": "1.0.1"
},
"frameworks": {
"net46": { }
},
"runtimes": {
"win7": { }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading;
using System.Threading.Tasks;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Remote
{
internal partial class DefaultRemoteHostClientServiceFactory
{
public class RemoteHostClientService : IRemoteHostClientService
{
private readonly AsyncLazy<RemoteHostClient> _lazyInstance;
public RemoteHostClientService(Workspace workspace)
{
var remoteHostClientFactory = workspace.Services.GetService<IRemoteHostClientFactory>();
if (remoteHostClientFactory == null)
{
// no implementation of remote host client
return;
}
_lazyInstance = new AsyncLazy<RemoteHostClient>(c => remoteHostClientFactory.CreateAsync(workspace, c), cacheResult: true);
}
public Task<RemoteHostClient> GetRemoteHostClientAsync(CancellationToken cancellationToken)
{
if (_lazyInstance == null)
{
return SpecializedTasks.Default<RemoteHostClient>();
}
return _lazyInstance.GetValueAsync(cancellationToken);
}
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Composition;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.Remote
{
/// <summary>
/// Default implementation of IRemoteHostClientService
/// </summary>
[ExportWorkspaceServiceFactory(typeof(IRemoteHostClientService)), Shared]
internal partial class DefaultRemoteHostClientServiceFactory : IWorkspaceServiceFactory
{
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
return new RemoteHostClientService(workspaceServices.Workspace);
}
}
}
......@@ -2,10 +2,9 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.VisualStudio.LanguageServices.Remote
namespace Microsoft.CodeAnalysis.Remote
{
/// <summary>
/// Create new <see cref="RemoteHostClient"/>.
......
......@@ -4,7 +4,7 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.VisualStudio.LanguageServices.Remote
namespace Microsoft.CodeAnalysis.Remote
{
/// <summary>
/// Returns a <see cref="RemoteHostClient"/> that a user can use to communicate with a remote host (i.e. ServiceHub)
......
......@@ -5,11 +5,10 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Execution;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Remote
namespace Microsoft.CodeAnalysis.Remote
{
/// <summary>
/// This lets users create a session to communicate with remote host (i.e. ServiceHub)
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.VisualStudio.LanguageServices.Remote
namespace Microsoft.CodeAnalysis.Remote
{
internal class WellKnownRemoteHostServices
{
......
......@@ -276,12 +276,11 @@
<InternalsVisibleToTest Include="Roslyn.Services.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.CSharp.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.VisualBasic.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Test.Utilities.Desktop" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.CSharp.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Closed.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Setup" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Utilities" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Utilities.Next" />
<InternalsVisibleToTest Include="Roslyn.Test.Utilities.Workspaces" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Services.UnitTests" />
<InternalsVisibleToTest Include="RoslynETAHost" />
<InternalsVisibleToTest Include="RoslynTaoActions" />
......@@ -392,6 +391,12 @@
<Compile Include="Options\GlobalOptionService.cs" />
<Compile Include="Options\IGlobalOptionService.cs" />
<Compile Include="Options\IWorkspaceOptionService.cs" />
<Compile Include="Remote\IRemoteHostClientFactory.cs" />
<Compile Include="Remote\IRemoteHostClientService.cs" />
<Compile Include="Remote\RemoteHostClient.cs" />
<Compile Include="Remote\DefaultRemoteHostClientServiceFactory.cs" />
<Compile Include="Remote\DefaultRemoteHostClientServiceFactory.RemoteHostClientService.cs" />
<Compile Include="Remote\WellKnownRemoteHostServices.cs" />
<Compile Include="Shared\RuntimeOptions.cs" />
<Compile Include="Shared\RuntimeOptionsProvider.cs" />
<Compile Include="Shared\Utilities\IStreamingProgressTracker.cs" />
......
......@@ -70,7 +70,7 @@
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.TestImpact.BuildManager" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Utilities.Next" />
<InternalsVisibleToTest Include="Roslyn.Services.Test.Utilities" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
</ItemGroup>
<ItemGroup>
......
{
"dependencies": {
"StreamJsonRpc": "0.14.6-alpha"
"StreamJsonRpc": "0.12.32-alpha-g90be50f449"
},
"frameworks": {
"net46": { }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册