提交 003bbae7 编写于 作者: H Heejae Chang

check command line mode before starting solution crawler and remote host.

I didn't make whole language service to not start since I wasn't sure end result of
such big change. that probably should be done by IDE team.
上级 40b6ac6b
......@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Packaging;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.SymbolSearch;
......@@ -68,7 +69,7 @@ protected override void Initialize()
RegisterMiscellaneousFilesWorkspaceInformation(_miscellaneousFilesWorkspace);
this.Workspace = this.CreateWorkspace();
if (this.Workspace != null)
if (IsInIdeMode(this.Workspace))
{
// make sure solution crawler start once everything has been setup.
// this also should be started before any of workspace events start firing
......@@ -132,7 +133,7 @@ protected override void Dispose(bool disposing)
_miscellaneousFilesWorkspace.StopSolutionCrawler();
}
if (this.Workspace != null)
if (IsInIdeMode(this.Workspace))
{
this.Workspace.StopSolutionCrawler();
......@@ -151,6 +152,24 @@ protected override void Dispose(bool disposing)
protected abstract string RoslynLanguageName { get; }
private bool IsInIdeMode(Workspace workspace)
{
return workspace != null && !IsInCommandLineMode();
}
private bool IsInCommandLineMode()
{
var shell = (IVsShell)this.GetService(typeof(SVsShell));
object result;
if (ErrorHandler.Succeeded(shell.GetProperty((int)__VSSPROPID.VSSPROPID_IsInCommandLineMode, out result)))
{
return (bool)result;
}
return false;
}
private void EnableRemoteHostClientService()
{
((RemoteHostClientServiceFactory.RemoteHostClientService)this.Workspace.Services.GetService<IRemoteHostClientService>()).Enable();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册