Skip to content

Commit b6a6d27

Browse files
committed
Fix non-Promise values in Promise.all in extension.ts
This commit fixes incorrect usage of Promise.all() where non-Promise values were being passed, causing ESLint errors. Problem: The restartQueryServer command was passing an array to Promise.all() containing: 1. A Promise (queryRunner.restartQueryServer) 2. Either a Promise or an empty object {} (conditional expression) 3. An async function (not invoked, so not a Promise) ESLint rule '@typescript-eslint/await-thenable' detected this error: src/extension.ts:200:11 Unexpected iterable of non-Promise (non-"Thenable") values passed to promise aggregator The issues were: - Line 199: Using `{}` as a fallback instead of a resolved Promise - Line 200: Declaring an async function but not invoking it (missing the `()` to actually call the function and get its Promise) Solution: 1. Replace `{}` with `Promise.resolve()` to maintain type consistency 2. Wrap the async function in an IIFE (Immediately Invoked Function Expression) by adding `()` at the end: `(async () => { ... })()` This ensures Promise.all() receives an array of actual Promise objects, allowing it to properly await all operations in parallel. File modified: - extensions/ql-vscode/src/extension.ts
1 parent 911f880 commit b6a6d27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ function getCommands(
196196
queryRunner.restartQueryServer(progress),
197197
queryRunnerForWarmingOverlayBaseCache
198198
? queryRunnerForWarmingOverlayBaseCache.restartQueryServer(progress)
199-
: {},
200-
async () => {
199+
: Promise.resolve(),
200+
(async () => {
201201
if (languageClient.isRunning()) {
202202
await languageClient.restart();
203203
} else {
204204
await languageClient.start();
205205
}
206-
},
206+
})(),
207207
]);
208208
void showAndLogInformationMessage(
209209
queryServerLogger,

0 commit comments

Comments
 (0)