From 167a0636948d11bc84cce272630781d7a26710f6 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Wed, 2 Oct 2024 18:00:51 +0200 Subject: [PATCH] fix: log watcher ignore, inverse shouldIgnore condition --- src/watcher.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/watcher.ts b/src/watcher.ts index 755fcc1..a8e9dc0 100644 --- a/src/watcher.ts +++ b/src/watcher.ts @@ -22,7 +22,7 @@ export class ExtensionWatcher extends vscode.Disposable { }) } - async watchTestFilesInWorkspace(api: VitestFolderAPI) { + watchTestFilesInWorkspace(api: VitestFolderAPI) { if (this.watcherByFolder.has(api.workspaceFolder)) return @@ -56,21 +56,25 @@ export class ExtensionWatcher extends vscode.Disposable { } private async shouldIgnoreFile(file: vscode.Uri) { + if (mm.isMatch(file.fsPath, this.ignorePattern)) { + return true + } try { const stats = await vscode.workspace.fs.stat(file) if ( - // if not a file + // if not a file stats.type !== vscode.FileType.File // if not a symlinked file && stats.type !== (vscode.FileType.File | vscode.FileType.SymbolicLink) ) { - return false + log.verbose?.('[VSCODE]', file.fsPath, 'is not a file. Ignoring.') + return true } - return mm.isMatch(file.fsPath, this.ignorePattern) + return false } catch (err: unknown) { log.verbose?.('[VSCODE] Error checking file stats:', file.fsPath, err as string) - return false + return true } } } -- 2.51.2