Reputation: 3979
I am new to TypeScript and Visual Studio Code and want to develop a plugin for Visual Studio Code. But I am hung up with an event fired by a FileSystemWatcher
. On activation, in my extension I create a FileSystemWatcher
and want it to inform me about changes to all TypeScript files. This is what I've been doing so far:
var watcher = vscode.workspace.createFileSystemWatcher("*.ts"); //glob search string
watcher.ignoreChangeEvents = false;
watcher.onDidChange(() => {
vscode.window.showInformationMessage("change applied!"); //In my opinion this should be called
});
I can see in debug that the watcher is created, but it never reacts to the event. Can someone explain how to use this callback the right way?
This is an event accessible via a function:
watcher.onDidChange
Upvotes: 3
Views: 5127
Reputation: 1044
On
var watcher = vscode.workspace.createFileSystemWatcher("*.ts");
please use "**/*.ts
instead of "*.ts"
.
Upvotes: 4