From 733c7a5c1fbd307538669e6dad4a1035f295a483 Mon Sep 17 00:00:00 2001 From: Sander Ronde Date: Fri, 10 May 2024 15:48:12 +0200 Subject: [PATCH] Call promise resolvers for debounced check (fixes #77) --- server/src/lib/phpstan/checkManager.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/lib/phpstan/checkManager.ts b/server/src/lib/phpstan/checkManager.ts index 33449ca..787aac5 100644 --- a/server/src/lib/phpstan/checkManager.ts +++ b/server/src/lib/phpstan/checkManager.ts @@ -52,9 +52,13 @@ export class PHPStanCheckManager implements AsyncDisposable { ...(existing?.promiseResolvers ?? []), resolve, ], - timeout: setTimeout(() => { + // eslint-disable-next-line @typescript-eslint/no-misused-promises + timeout: setTimeout(async () => { + const promiseResolvers = + this._queuedCalls.get(identifier)!.promiseResolvers; this._queuedCalls.delete(identifier); - void callback(); + await callback(); + promiseResolvers.forEach((resolve) => resolve()); }, CHECK_DEBOUNCE), }); });