Skip to content

Commit

Permalink
refactor: add log and clear apis on dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Nov 19, 2024
1 parent d7182da commit 59e2ad6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { log } from './log'

export class ExtensionWatcher extends vscode.Disposable {
private watcherByFolder = new Map<vscode.WorkspaceFolder, vscode.FileSystemWatcher>()
private apisByFolder = new Map<vscode.WorkspaceFolder, VitestFolderAPI[]>()
private apisByFolder = new WeakMap<vscode.WorkspaceFolder, VitestFolderAPI[]>()

constructor(private readonly testTree: TestTree) {
super(() => {
Expand All @@ -26,6 +26,7 @@ export class ExtensionWatcher extends vscode.Disposable {
const folder = api.workspaceFolder
const apis = this.apisByFolder.get(folder) ?? []
if (!apis.includes(api)) {
log.info('[API] Watching', api.id)
apis.push(api)
}
this.apisByFolder.set(folder, apis)
Expand Down

0 comments on commit 59e2ad6

Please sign in to comment.