提交 2c95e735 编写于 作者: D David Barbet

Move Rename implementation to new fully loaded document API.

上级 45e61aa3
...@@ -49,13 +49,13 @@ public bool ExecuteCommand(RenameCommandArgs args, CommandExecutionContext conte ...@@ -49,13 +49,13 @@ public bool ExecuteCommand(RenameCommandArgs args, CommandExecutionContext conte
{ {
using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Finding_token_to_rename)) using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Finding_token_to_rename))
{ {
ExecuteRenameWorker(args, context.OperationContext.UserCancellationToken); ExecuteRenameWorker(args, context);
} }
return true; return true;
} }
private void ExecuteRenameWorker(RenameCommandArgs args, CancellationToken cancellationToken) private void ExecuteRenameWorker(RenameCommandArgs args, CommandExecutionContext context)
{ {
var snapshot = args.SubjectBuffer.CurrentSnapshot; var snapshot = args.SubjectBuffer.CurrentSnapshot;
if (!Workspace.TryGetWorkspace(snapshot.AsText().Container, out var workspace)) if (!Workspace.TryGetWorkspace(snapshot.AsText().Container, out var workspace))
...@@ -89,7 +89,9 @@ private void ExecuteRenameWorker(RenameCommandArgs args, CancellationToken cance ...@@ -89,7 +89,9 @@ private void ExecuteRenameWorker(RenameCommandArgs args, CancellationToken cance
} }
var position = caretPoint.Value; var position = caretPoint.Value;
var document = args.SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); var cancellationToken = context.OperationContext.UserCancellationToken;
var document = args.SubjectBuffer.CurrentSnapshot.GetFullyLoadedOpenDocumentInCurrentContextWithChangesAsync(
context.OperationContext).WaitAndGetResult(cancellationToken);
if (document == null) if (document == null)
{ {
ShowErrorDialog(workspace, EditorFeaturesResources.You_must_rename_an_identifier); ShowErrorDialog(workspace, EditorFeaturesResources.You_must_rename_an_identifier);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册