Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 10, 2025 20:54
TaggerEventSources.OnWorkspaceRegistrationChanged(subjectBuffer),
TaggerEventSources.OnDocumentActiveContextChanged(subjectBuffer),
TaggerEventSources.OnTextChanged(subjectBuffer),
TaggerEventSources.OnParseOptionChanged(subjectBuffer));
Copy link
Member Author

@CyrusNajmabadi CyrusNajmabadi Jun 10, 2025

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.

Copy link
Contributor

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;
Copy link
Member Author

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);
Copy link
Member Author

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);
Copy link
Member Author

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;
Copy link
Member Author

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))
Copy link
Member Author

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.

buffer2.ChangedOnBackground -= OnTextBufferChanged;
else
_subjectBuffer.Changed -= OnTextBufferChanged;
}
Copy link
Member Author

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.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge June 10, 2025 22:11
@CyrusNajmabadi CyrusNajmabadi merged commit 345c918 into dotnet:main Jun 11, 2025
24 of 25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the removeWorkspaceRegistration branch June 11, 2025 05:48
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 11, 2025
CyrusNajmabadi added a commit that referenced this pull request Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants