From b6c6bf5f14eb58794e0a4c08f5027f73d8136415 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Mar 2026 15:11:58 +0000 Subject: [PATCH] fix: reject promise on phpcbf exit codes 0 and 3 to prevent hang When phpcbf exits with code 0 (nothing to fix), the Promise previously neither resolved nor rejected, causing VS Code's formatter to hang indefinitely. Users saw a spinning "Formatting..." indicator that never cleared, and subsequent saves stopped working until VS Code was restarted. Exit code 3 (general script execution error) had the same problem. Fix: call reject() for both exit codes so VS Code is immediately informed that no document edits are available and can move on. Closes #39 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- extension.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extension.js b/extension.js index 81a61ce..5df4f6c 100644 --- a/extension.js +++ b/extension.js @@ -192,6 +192,8 @@ class PHPCBF { */ switch (code) { case 0: + // Nothing to fix; signal to VS Code that there are no edits. + reject(); break; case 1: case 2: @@ -204,6 +206,8 @@ class PHPCBF { break; case 3: phpcbfError = true; + // Reject so the promise does not hang indefinitely. + reject(); break; default: let msgs = {