making the filtering function synchronous

This commit is contained in:
Aiday Marlen Kyzy 2023-11-20 18:24:45 +01:00
parent a86c36c6b0
commit 5285e1d97e
No known key found for this signature in database
GPG key ID: 24A8B53DBD26FF4E

View file

@ -557,7 +557,8 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
return undefined; return undefined;
} }
const actions = (await this.convertApplicableRefactors(document, response.body, rangeOrSelection)).filter(async action => { const documentSymbols = await vscode.commands.executeCommand<(vscode.SymbolInformation & vscode.DocumentSymbol)[]>('vscode.executeDocumentSymbolProvider', document.uri);
const actions = (await this.convertApplicableRefactors(document, response.body, rangeOrSelection)).filter(action => {
if (this.client.apiVersion.lt(API.v430)) { if (this.client.apiVersion.lt(API.v430)) {
// Don't show 'infer return type' refactoring unless it has been explicitly requested // Don't show 'infer return type' refactoring unless it has been explicitly requested
// https://github.com/microsoft/TypeScript/issues/42993 // https://github.com/microsoft/TypeScript/issues/42993
@ -566,7 +567,6 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider<TsCodeActi
} }
} }
if (action.kind?.value === Move_NewFile.kind.value) { if (action.kind?.value === Move_NewFile.kind.value) {
const documentSymbols = await vscode.commands.executeCommand<(vscode.SymbolInformation & vscode.DocumentSymbol)[]>('vscode.executeDocumentSymbolProvider', document.uri);
return MoveToFileCodeAction.shouldIncludeCodeAction(documentSymbols, rangeOrSelection); return MoveToFileCodeAction.shouldIncludeCodeAction(documentSymbols, rangeOrSelection);
} }
return true; return true;