-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Simplify workspace hookup in syntactic tagger #78909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify workspace hookup in syntactic tagger #78909
Conversation
| TaggerEventSources.OnWorkspaceRegistrationChanged(subjectBuffer), | ||
| TaggerEventSources.OnDocumentActiveContextChanged(subjectBuffer), | ||
| TaggerEventSources.OnTextChanged(subjectBuffer), | ||
| TaggerEventSources.OnParseOptionChanged(subjectBuffer)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these represent the 5 different things we listened to wrt to the subject buffer. i will call that out below for the old code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TaggerEventSources is a nifty little object
| ConnectToWorkspace(_workspaceRegistration.Workspace); | ||
| _taggerEventSource.Changed += OnEventSourceChanged; | ||
|
|
||
| _subjectBuffer.ChangedOnBackground += this.OnSubjectBufferChanged; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is where we were listening to text changes.
| DisconnectFromWorkspace(); | ||
|
|
||
| if (newWorkspace != null) | ||
| ConnectToWorkspace(newWorkspace); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is where we listened to the workspace changing.
|
|
||
| _workspace = workspace; | ||
| _workspaceChangedDisposer = _workspace.RegisterWorkspaceChangedHandler(this.OnWorkspaceChanged); | ||
| _workspaceDocumentActiveContextChangedDisposer = _workspace.RegisterDocumentActiveContextChangedHandler(this.OnDocumentActiveContextChanged); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is where we listened for workspace and active doc changes.
|
|
||
| public override void Disconnect() | ||
| => _subjectBuffer.Changed -= OnTextBufferChanged; | ||
| => _subjectBuffer.ChangedOnBackground -= OnTextBufferChanged; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all usages of thsi event source are taggers or features that already can hear about events on the BG.
|
|
||
| // In case of parse options change reclassify the doc as it may have affected things | ||
| // like preprocessor directives. | ||
| if (Equals(oldProject?.ParseOptions, newProject?.ParseOptions)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking if parse options were changing.
src/EditorFeatures/Core/InlineDiagnostics/AbstractDiagnosticsTaggerProvider.cs
Show resolved
Hide resolved
| buffer2.ChangedOnBackground -= OnTextBufferChanged; | ||
| else | ||
| _subjectBuffer.Changed -= OnTextBufferChanged; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all existing uses of this type are through taggers and other features that support getting notifications on a BG thread.
src/EditorFeatures/Core/StringIndentation/StringIndentationTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Tagging/AsynchronousViewportTaggerProvider.cs
Outdated
Show resolved
Hide resolved
ToddGrun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
No description provided.