提交 609794ed 编写于 作者: S Sam Harwell

Revert "Merge pull request #23364 from tmat/DisableBackgroundCompiler"

This reverts commit 80d79c40, reversing
changes made to 37ef0cde.
上级 949c9b4f
...@@ -39,6 +39,9 @@ public partial class TestWorkspace : Workspace ...@@ -39,6 +39,9 @@ public partial class TestWorkspace : Workspace
public IList<TestHostDocument> AdditionalDocuments { get; } public IList<TestHostDocument> AdditionalDocuments { get; }
public IList<TestHostDocument> ProjectionDocuments { get; } public IList<TestHostDocument> ProjectionDocuments { get; }
private readonly BackgroundCompiler _backgroundCompiler;
private readonly BackgroundParser _backgroundParser;
public TestWorkspace() public TestWorkspace()
: this(TestExportProvider.ExportProviderWithCSharpAndVisualBasic, WorkspaceKind.Test) : this(TestExportProvider.ExportProviderWithCSharpAndVisualBasic, WorkspaceKind.Test)
{ {
...@@ -57,6 +60,10 @@ public TestWorkspace(ExportProvider exportProvider, string workspaceKind = null, ...@@ -57,6 +60,10 @@ public TestWorkspace(ExportProvider exportProvider, string workspaceKind = null,
this.ProjectionDocuments = new List<TestHostDocument>(); this.ProjectionDocuments = new List<TestHostDocument>();
this.CanApplyChangeDocument = true; this.CanApplyChangeDocument = true;
_backgroundCompiler = new BackgroundCompiler(this);
_backgroundParser = new BackgroundParser(this);
_backgroundParser.Start();
} }
/// <summary> /// <summary>
...@@ -83,9 +90,30 @@ internal static void ResetThreadAffinity(ForegroundThreadData foregroundThreadDa ...@@ -83,9 +90,30 @@ internal static void ResetThreadAffinity(ForegroundThreadData foregroundThreadDa
} }
} }
protected internal override bool PartialSemanticsEnabled
{
get { return _backgroundCompiler != null; }
}
public TestHostDocument DocumentWithCursor public TestHostDocument DocumentWithCursor
=> Documents.Single(d => d.CursorPosition.HasValue && !d.IsLinkFile); => Documents.Single(d => d.CursorPosition.HasValue && !d.IsLinkFile);
protected override void OnDocumentTextChanged(Document document)
{
if (_backgroundParser != null)
{
_backgroundParser.Parse(document);
}
}
protected override void OnDocumentClosing(DocumentId documentId)
{
if (_backgroundParser != null)
{
_backgroundParser.CancelParse(documentId);
}
}
public new void RegisterText(SourceTextContainer text) public new void RegisterText(SourceTextContainer text)
{ {
base.RegisterText(text); base.RegisterText(text);
...@@ -153,6 +181,11 @@ protected override void Dispose(bool finalize) ...@@ -153,6 +181,11 @@ protected override void Dispose(bool finalize)
Dispatcher.CurrentDispatcher.DoEvents(); Dispatcher.CurrentDispatcher.DoEvents();
} }
if (_backgroundParser != null)
{
_backgroundParser.CancelAllParses();
}
base.Dispose(finalize); base.Dispose(finalize);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册