Skip to content

Commit

Permalink
automatically watch ghcid.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismwendt committed Mar 24, 2020
1 parent ff04af8 commit 86e91a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"Linters"
],
"activationEvents": [
"onCommand:extension.startGhcid"
"onCommand:extension.startGhcid",
"workspaceContains:**/ghcid.txt"
],
"main": "./out/src/extension",
"contributes": {
Expand Down
10 changes: 10 additions & 0 deletions plugins/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ export function activate(context: vscode.ExtensionContext) {
oldTerminal.show();
return watchOutput(vscode.workspace.rootPath, file);
});

const watcher = vscode.workspace.createFileSystemWatcher('**/ghcid.txt')
context.subscriptions.push(watcher);
watcher.onDidCreate(uri => {
// TODO support multiple roots
// TODO support multiple 'ghcid.txt's
// TODO rxjsify this shit and properly manage subscriptions
cleanup()
oldWatcher = watchOutput(path.dirname(uri.fsPath), uri.fsPath);
})
}

// this method is called when your extension is deactivated
Expand Down

0 comments on commit 86e91a4

Please sign in to comment.