Unify the final state management processing in inline-rename.#61512
Unify the final state management processing in inline-rename.#61512CyrusNajmabadi merged 5 commits intodotnet:mainfrom
Conversation
| _previewChanges = value; | ||
| } | ||
|
|
||
| private void Dismiss(bool rollbackTemporaryEdits) |
There was a problem hiding this comment.
Dismiss was called from one location only. So it was inlined as a local function in that one place to make sure nothing else calls it directly. It was entirely unchanged.
|
|
||
| // We're about to perform the final commit action. No need to do any of our BG work to find-refs or compute conflicts. | ||
| _cancellationTokenSource.Cancel(); | ||
| _conflictResolutionTaskCancellationSource.Cancel(); |
There was a problem hiding this comment.
these two cancels were in CancelAllOpenDocumentTrackingTasks. This was the only place that called that, so this was inlined here.
| private void DismissUIAndRollbackEditsAndEndRenameSession( | ||
| RenameLogMessage.UserActionOutcome outcome, | ||
| bool previewChanges, | ||
| Action finalCommitAction = null) |
There was a problem hiding this comment.
two codepaths are just ones that dismiss/cleanup without committing. And one codepath actually has some commit logic it performs before final cleanup. So i represented this as this single method with the optional commit action to perform.
| RenameTrackingDismisser.DismissRenameTracking(_workspace, _workspace.GetOpenDocumentIds()); | ||
|
|
||
| // Log how long the full rename took. | ||
| _inlineRenameSessionDurationLogBlock.Dispose(); |
There was a problem hiding this comment.
The above code is waht was in EndRenameSession. It was only called here, so i inlined as well.
| catch (InvalidOperationException ex) when (FatalError.ReportAndCatch(ex)) | ||
| { | ||
| // Unreachable code due to ReportAndCatch | ||
| Contract.ThrowIfTrue(true); |
There was a problem hiding this comment.
just removed this as it's not needed at all.
Followup to #61509.
This takes the 3 codepaths that end up ending the rename-session and get them to use one common cleanup routine. WIll doc inline.