提交 9e0e7dfe 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #14058 from CyrusNajmabadi/delayLoadSimplification

Simplify our delay-loaded services.
......@@ -127,9 +127,6 @@ protected void RegisterLanguageService(Type t, Func<object> serviceCreator)
protected override void Dispose(bool disposing)
{
_packageInstallerService?.Disconnect(this.RoslynLanguageName);
_symbolSearchService?.Disconnect(this.RoslynLanguageName);
if (_miscellaneousFilesWorkspace != null)
{
_miscellaneousFilesWorkspace.StopSolutionCrawler();
......
......@@ -101,20 +101,6 @@ protected override void EnableService()
_packageServices.SourcesChanged += OnSourceProviderSourcesChanged;
}
protected override void StopWorking()
{
this.AssertIsForeground();
if (!IsEnabled)
{
return;
}
// Stop listening to workspace changes.
_workspace.WorkspaceChanged -= OnWorkspaceChanged;
_packageServices.SourcesChanged -= OnSourceProviderSourcesChanged;
}
protected override void StartWorking()
{
this.AssertIsForeground();
......
......@@ -43,7 +43,6 @@ internal abstract class AbstractDelayStartedService : ForegroundThreadAffinitize
protected abstract void EnableService();
protected abstract void StartWorking();
protected abstract void StopWorking();
internal void Connect(string languageName)
{
......@@ -95,30 +94,5 @@ private bool IsRegisteredForLanguage(string language)
var options = Workspace.Options;
return _perLanguageOptions.Any(o => options.GetOption(o, language));
}
internal void Disconnect(string languageName)
{
this.AssertIsForeground();
var options = Workspace.Options;
if (!options.GetOption(_serviceOnOffOption))
{
// Feature is totally disabled. Do nothing.
return;
}
_registeredLanguageNames.Remove(languageName);
if (_registeredLanguageNames.Count == 0)
{
if (_enabled)
{
_enabled = false;
StopWorking();
}
var optionsService = Workspace.Services.GetService<IOptionService>();
optionsService.OptionChanged -= OnOptionChanged;
}
}
}
}
\ No newline at end of file
......@@ -140,12 +140,6 @@ protected override void StartWorking()
}
}
protected override void StopWorking()
{
_installerService.PackageSourcesChanged -= OnPackageSourcesChanged;
_cancellationTokenSource.Cancel();
}
public IEnumerable<PackageWithTypeResult> FindPackagesWithType(
string source, string name, int arity, CancellationToken cancellationToken)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册