Skip to content

Commit

Permalink
Fix active document handling in BackgroundParser
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Apr 21, 2021
1 parent 56203e6 commit 173e0e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Features/Core/Portable/Workspace/BackgroundParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ public BackgroundParser(Workspace workspace)
_taskQueue = new TaskQueue(listenerProvider.GetListener(), TaskScheduler.Default);

_documentTrackingService = workspace.Services.GetRequiredService<IDocumentTrackingService>();
_documentTrackingService.ActiveDocumentChanged += OnActiveDocumentChanged;

_workspace.WorkspaceChanged += OnWorkspaceChanged;

workspace.DocumentOpened += OnDocumentOpened;
workspace.DocumentClosed += OnDocumentClosed;
}

private void OnActiveDocumentChanged(object sender, DocumentId activeDocumentId)
=> Parse(_workspace.CurrentSolution.GetDocument(activeDocumentId));

private void OnDocumentOpened(object sender, DocumentEventArgs args)
=> Parse(args.Document);

Expand Down

0 comments on commit 173e0e5

Please sign in to comment.