Prevent unexpected rename cancellation

上级 d88608d3
......@@ -180,6 +180,9 @@ class RenameController implements IEditorContribution {
}
const supportPreview = this._bulkEditService.hasPreviewHandler() && this._configService.getValue<boolean>(this.editor.getModel().uri, 'editor.rename.enablePreview');
// Special cancellation handling here (allows the user to move the cursor but only within loc.range):
this._cts.dispose(false);
const inputFieldResult = await this._renameInputField.getValue().getInput(loc.range, loc.text, selectionStart, selectionEnd, supportPreview);
// no result, only hint to focus the editor or not
......@@ -190,6 +193,8 @@ class RenameController implements IEditorContribution {
return undefined;
}
this._cts = new EditorStateCancellationTokenSource(this.editor, CodeEditorStateFlag.Position | CodeEditorStateFlag.Value);
this.editor.focus();
const renameOperation = raceCancellation(skeleton.provideRenameEdits(inputFieldResult.newName, 0, [], this._cts.token), this._cts.token).then(async renameResult => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册