提交 1380206e 编写于 作者: K Kevin Halverson

Allow service created by RemoteHostClient to be specified as a parameter...

上级 1de8aa90
...@@ -25,26 +25,26 @@ protected RemoteHostClient(Workspace workspace) ...@@ -25,26 +25,26 @@ protected RemoteHostClient(Workspace workspace)
public event EventHandler<bool> ConnectionChanged; public event EventHandler<bool> ConnectionChanged;
public Task<Session> CreateCodeAnalysisServiceSessionAsync(Solution solution, CancellationToken cancellationToken) public Task<Session> CreateServiceSessionAsync(string serviceName, Solution solution, CancellationToken cancellationToken)
{ {
return CreateCodeAnalysisServiceSessionAsync(solution, callbackTarget: null, cancellationToken: cancellationToken); return CreateServiceSessionAsync(serviceName, solution, callbackTarget: null, cancellationToken: cancellationToken);
} }
public async Task<Session> CreateCodeAnalysisServiceSessionAsync(Solution solution, object callbackTarget, CancellationToken cancellationToken) public async Task<Session> CreateServiceSessionAsync(string serviceName, Solution solution, object callbackTarget, CancellationToken cancellationToken)
{ {
Contract.ThrowIfFalse(solution.Workspace == _workspace); Contract.ThrowIfFalse(solution.Workspace == _workspace);
var service = _workspace.Services.GetService<ISolutionChecksumService>(); var service = _workspace.Services.GetService<ISolutionChecksumService>();
var snapshot = await service.CreateChecksumAsync(solution, cancellationToken).ConfigureAwait(false); var snapshot = await service.CreateChecksumAsync(solution, cancellationToken).ConfigureAwait(false);
return await CreateCodeAnalysisServiceSessionAsync(snapshot, callbackTarget, cancellationToken).ConfigureAwait(false); return await CreateServiceSessionAsync(serviceName, snapshot, callbackTarget, cancellationToken).ConfigureAwait(false);
} }
protected abstract void OnConnected(); protected abstract void OnConnected();
protected abstract void OnDisconnected(); protected abstract void OnDisconnected();
protected abstract Task<Session> CreateCodeAnalysisServiceSessionAsync(ChecksumScope snapshot, object callbackTarget, CancellationToken cancellationToken); protected abstract Task<Session> CreateServiceSessionAsync(string serviceName, ChecksumScope snapshot, object callbackTarget, CancellationToken cancellationToken);
internal void Shutdown() internal void Shutdown()
{ {
......
...@@ -84,7 +84,7 @@ internal class OutOfProcDiagnosticAnalyzerExecutor : IRemoteHostDiagnosticAnalyz ...@@ -84,7 +84,7 @@ internal class OutOfProcDiagnosticAnalyzerExecutor : IRemoteHostDiagnosticAnalyz
} }
// TODO: send telemetry on session // TODO: send telemetry on session
using (var session = await client.CreateCodeAnalysisServiceSessionAsync(solution, cancellationToken).ConfigureAwait(false)) using (var session = await client.CreateServiceSessionAsync(WellKnownServiceHubServices.CodeAnalysisService, solution, cancellationToken).ConfigureAwait(false))
{ {
var argument = new DiagnosticArguments( var argument = new DiagnosticArguments(
analyzerDriver.AnalysisOptions.ReportSuppressedDiagnostics, analyzerDriver.AnalysisOptions.ReportSuppressedDiagnostics,
......
...@@ -55,7 +55,7 @@ public static async Task<RemoteHostClient> CreateAsync(Workspace workspace, Canc ...@@ -55,7 +55,7 @@ public static async Task<RemoteHostClient> CreateAsync(Workspace workspace, Canc
_rpc.Disconnected += OnRpcDisconnected; _rpc.Disconnected += OnRpcDisconnected;
} }
protected override async Task<Session> CreateCodeAnalysisServiceSessionAsync(ChecksumScope snapshot, object callbackTarget, CancellationToken cancellationToken) protected override async Task<Session> CreateServiceSessionAsync(string serviceName, ChecksumScope snapshot, object callbackTarget, CancellationToken cancellationToken)
{ {
// get stream from service hub to communicate snapshot/asset related information // 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 // this is the back channel the system uses to move data between VS and remote host
...@@ -63,7 +63,7 @@ protected override async Task<Session> CreateCodeAnalysisServiceSessionAsync(Che ...@@ -63,7 +63,7 @@ protected override async Task<Session> CreateCodeAnalysisServiceSessionAsync(Che
// get stream from service hub to communicate service specific information // get stream from service hub to communicate service specific information
// this is what consumer actually use to communicate information // this is what consumer actually use to communicate information
var serviceStream = await _hubClient.RequestServiceAsync(WellKnownServiceHubServices.CodeAnalysisService, cancellationToken).ConfigureAwait(false); var serviceStream = await _hubClient.RequestServiceAsync(serviceName, cancellationToken).ConfigureAwait(false);
return new JsonRpcSession(snapshot, snapshotStream, callbackTarget, serviceStream, cancellationToken); return new JsonRpcSession(snapshot, snapshotStream, callbackTarget, serviceStream, cancellationToken);
} }
......
...@@ -121,5 +121,8 @@ ...@@ -121,5 +121,8 @@
<LastGenOutput>ServicesVisualStudioNextResources.Designer.cs</LastGenOutput> <LastGenOutput>ServicesVisualStudioNextResources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.TestImpact.BuildManager" />
</ItemGroup>
<Import Project="..\..\..\build\Targets\VSL.Imports.targets" /> <Import Project="..\..\..\build\Targets\VSL.Imports.targets" />
</Project> </Project>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册