提交 73d57ccd 编写于 作者: C CyrusNajmabadi

Enable the OutOfProc server by default.

This is necessary now that several IDE features (i.e. FindReferences/NavigateTo) use OutOfProc by default.
If the server is not on, these guys just fall back and compute everything in-proc, defeating the point.

This also addresses issues where OutOfProc wouldn't be used even when it was supposed to.  For example,
if 'CodeLens' was off, but was then turned on, then OutOfProc still wouldn't be used.
上级 2d339b4b
......@@ -63,12 +63,6 @@ public void Enable()
return;
}
if (!FeaturesEnabled())
{
// none of features that require OOP is enabled.
return;
}
// log that remote host is enabled
Logger.Log(FunctionId.RemoteHostClientService_Enabled, KeyValueLogMessage.NoProperty);
......@@ -213,26 +207,6 @@ private void OnConnectionChanged(object sender, bool connected)
FatalError.Report(new Exception("Connection to remote host closed"));
}
private bool FeaturesEnabled()
{
if (ServiceFeatureOnOffOptions.IsClosedFileDiagnosticsEnabled(_workspace.Options, LanguageNames.CSharp))
{
return true;
}
if (DynamicAnalysisEnabled())
{
return true;
}
if (CodeLenEnabled())
{
return true;
}
return false;
}
private bool DynamicAnalysisEnabled()
{
const string dynamicAnalysisPackageGuid = "3EADAB3E-2035-4513-8C13-FBA84414A16C";
......
......@@ -3,9 +3,8 @@
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Remote;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Remote
......@@ -15,20 +14,20 @@ namespace Microsoft.VisualStudio.LanguageServices.Remote
[ExportWorkspaceService(typeof(IRemoteHostClientFactory)), Shared]
internal class RemoteHostClientFactory : IRemoteHostClientFactory
{
public Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken)
public async Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken)
{
try
{
// this is the point where we can create different kind of remote host client in future (cloud or etc)
return ServiceHubRemoteHostClient.CreateAsync(workspace, cancellationToken);
return await ServiceHubRemoteHostClient.CreateAsync(workspace, cancellationToken).ConfigureAwait(false);
}
catch
{
// currently there is so many moving parts that cause, in some branch/drop,
// service hub not to work. in such places (ex, Jenkins), rather than crashing VS
// right away, let VS run without service hub enabled.
return SpecializedTasks.Default<RemoteHostClient>();
return null;
}
}
}
}
}
\ No newline at end of file
......@@ -4,7 +4,6 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Execution;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Remote;
......
......@@ -14,22 +14,22 @@ namespace Roslyn.VisualStudio.DiagnosticsWindow.Remote
[ExportWorkspaceService(typeof(IRemoteHostClientFactory), layer: ServiceLayer.Host), Shared]
internal class RemoteHostClientFactory : IRemoteHostClientFactory
{
public Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken)
public async Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken)
{
try
{
// this is the point where we can create different kind of remote host client in future (cloud or etc)
if (workspace.Options.GetOption(RemoteHostClientFactoryOptions.RemoteHost_InProc))
{
return InProcRemoteHostClient.CreateAsync(workspace, cancellationToken);
return await InProcRemoteHostClient.CreateAsync(workspace, cancellationToken).ConfigureAwait(false);
}
return ServiceHubRemoteHostClient.CreateAsync(workspace, cancellationToken);
return await ServiceHubRemoteHostClient.CreateAsync(workspace, cancellationToken).ConfigureAwait(false);
}
catch
{
return Task.FromResult<RemoteHostClient>(null);
return null;
}
}
}
}
}
\ No newline at end of file
......@@ -15,4 +15,4 @@ internal interface IRemoteHostClientFactory : IWorkspaceService
{
Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken);
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册