From baf5a99d15b8e14cf638bef8217bcccf0d4cfee5 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Fri, 29 Mar 2024 03:03:41 +0800 Subject: [PATCH] fix(vscode): newly created file failed to match tsconfig immediately refs https://github.com/vuejs/language-tools/issues/4167 --- packages/vscode/lib/features/tsconfig.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vscode/lib/features/tsconfig.ts b/packages/vscode/lib/features/tsconfig.ts index 10ed67c1..d24dfeff 100644 --- a/packages/vscode/lib/features/tsconfig.ts +++ b/packages/vscode/lib/features/tsconfig.ts @@ -11,11 +11,16 @@ export function activate( const subscriptions: vscode.Disposable[] = []; const statusBar = vscode.languages.createLanguageStatusItem(cmd, selector); + let currentTsconfigUri: vscode.Uri | undefined; + let updateStatus: ReturnType | undefined; updateStatusBar(); - vscode.window.onDidChangeActiveTextEditor(updateStatusBar, undefined, subscriptions); + vscode.window.onDidChangeActiveTextEditor(() => { + clearTimeout(updateStatus); + updateStatus = setTimeout(() => updateStatusBar, 100); + }, undefined, subscriptions); subscriptions.push(vscode.commands.registerCommand(cmd, async () => { if (currentTsconfigUri) {