Skip to content

Commit

Permalink
Put the method after the check
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosifne committed Aug 27, 2024
1 parent 73c2f85 commit 23a72fb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -761,13 +761,6 @@ public async Task CommitAsync(bool previewChanges, IUIThreadOperationContext edi
private async Task<bool> CommitWorkerAsync(bool previewChanges, bool canUseBackgroundWorkIndicator, IUIThreadOperationContext editorUIOperationContext)
{
await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync();
if (editorUIOperationContext is not null)
{
// Prevent Editor's typing responsiveness auto canceling the rename operation.
// InlineRenameSession will call IUIThreadOperationExecutor to sets up our own IUIThreadOperationContext
editorUIOperationContext.TakeOwnership();
}

VerifyNotDismissed();

// If the identifier was deleted (or didn't change at all) then cancel the operation.
Expand All @@ -788,6 +781,13 @@ private async Task<bool> CommitWorkerAsync(bool previewChanges, bool canUseBackg

previewChanges = previewChanges || PreviewChanges;

if (editorUIOperationContext is not null)
{
// Prevent Editor's typing responsiveness auto canceling the rename operation.
// InlineRenameSession will call IUIThreadOperationExecutor to sets up our own IUIThreadOperationContext
editorUIOperationContext.TakeOwnership();
}

try
{
if (canUseBackgroundWorkIndicator)
Expand Down

0 comments on commit 23a72fb

Please sign in to comment.