提交 a87dc2b6 编写于 作者: M Matt Bierner

Interup getError for refactor and updatePaths on rename

These are user triggered operations that should interupt the background getError requests
上级 d02be784
...@@ -137,10 +137,12 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { ...@@ -137,10 +137,12 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
return undefined; return undefined;
} }
await this.formattingOptionsManager.ensureConfigurationForDocument(document, token);
const args: Proto.GetApplicableRefactorsRequestArgs = typeConverters.Range.toFileRangeRequestArgs(file, rangeOrSelection); const args: Proto.GetApplicableRefactorsRequestArgs = typeConverters.Range.toFileRangeRequestArgs(file, rangeOrSelection);
const response = await this.client.execute('getApplicableRefactors', args, token); const response = await this.client.interuptGetErr(() => {
this.formattingOptionsManager.ensureConfigurationForDocument(document, token);
return this.client.execute('getApplicableRefactors', args, token);
});
if (response.type !== 'response' || !response.body) { if (response.type !== 'response' || !response.body) {
return undefined; return undefined;
} }
......
...@@ -230,21 +230,19 @@ class UpdateImportsOnFileRenameHandler extends Disposable { ...@@ -230,21 +230,19 @@ class UpdateImportsOnFileRenameHandler extends Disposable {
document: vscode.TextDocument, document: vscode.TextDocument,
oldFile: string, oldFile: string,
newFile: string, newFile: string,
) { ): Promise<vscode.WorkspaceEdit | undefined> {
const isDirectoryRename = fs.lstatSync(newFile).isDirectory(); const isDirectoryRename = fs.lstatSync(newFile).isDirectory();
await this.fileConfigurationManager.setGlobalConfigurationFromDocument(document, nulToken);
const args: Proto.GetEditsForFileRenameRequestArgs & { file: string } = { const response = await this.client.interuptGetErr(() => {
file: targetResource, this.fileConfigurationManager.setGlobalConfigurationFromDocument(document, nulToken);
oldFilePath: oldFile, const args: Proto.GetEditsForFileRenameRequestArgs & { file: string } = {
newFilePath: newFile, file: targetResource,
}; oldFilePath: oldFile,
const response = await this.client.execute('getEditsForFileRename', args, nulToken); newFilePath: newFile,
if (response.type !== 'response') { };
return; return this.client.execute('getEditsForFileRename', args, nulToken);
} });
if (response.type !== 'response' || !response.body) {
if (!response.body) {
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册