Interup getError for refactor and updatePaths on rename

These are user triggered operations that should interupt the background getError requests
This commit is contained in:
Matt Bierner
2018-12-14 13:48:53 -08:00
parent d02be78457
commit a87dc2b62f
2 changed files with 16 additions and 16 deletions

View File

@@ -137,10 +137,12 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
return undefined;
}
await this.formattingOptionsManager.ensureConfigurationForDocument(document, token);
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) {
return undefined;
}

View File

@@ -230,21 +230,19 @@ class UpdateImportsOnFileRenameHandler extends Disposable {
document: vscode.TextDocument,
oldFile: string,
newFile: string,
) {
): Promise<vscode.WorkspaceEdit | undefined> {
const isDirectoryRename = fs.lstatSync(newFile).isDirectory();
await this.fileConfigurationManager.setGlobalConfigurationFromDocument(document, nulToken);
const response = await this.client.interuptGetErr(() => {
this.fileConfigurationManager.setGlobalConfigurationFromDocument(document, nulToken);
const args: Proto.GetEditsForFileRenameRequestArgs & { file: string } = {
file: targetResource,
oldFilePath: oldFile,
newFilePath: newFile,
};
const response = await this.client.execute('getEditsForFileRename', args, nulToken);
if (response.type !== 'response') {
return;
}
if (!response.body) {
return this.client.execute('getEditsForFileRename', args, nulToken);
});
if (response.type !== 'response' || !response.body) {
return;
}