Skip to content

Commit ee2f147

Browse files
committed
Improve disposable
1 parent 3b62bd2 commit ee2f147

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Disposable, FileSystem, PathChangeListener } from "@cursorless/common";
2+
import * as vscode from "vscode";
23
import { RelativePattern, Uri, workspace } from "vscode";
34

45
export class VscodeFileSystem implements FileSystem {
@@ -7,9 +8,12 @@ export class VscodeFileSystem implements FileSystem {
78
const watcher = workspace.createFileSystemWatcher(
89
new RelativePattern(Uri.file(path), "**"),
910
);
10-
watcher.onDidChange(onDidChange);
11-
watcher.onDidCreate(onDidChange);
12-
watcher.onDidDelete(onDidChange);
13-
return watcher;
11+
12+
return vscode.Disposable.from(
13+
watcher,
14+
watcher.onDidChange(onDidChange),
15+
watcher.onDidCreate(onDidChange),
16+
watcher.onDidDelete(onDidChange),
17+
);
1418
}
1519
}

0 commit comments

Comments
 (0)