Skip to content

Commit b80e840

Browse files
committed
feat: run version checks on refresh
1 parent 686302a commit b80e840

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/providers/taskTreeDataProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class TaskTreeDataProvider implements vscode.TreeDataProvider<elements.Tr
3838
}
3939

4040
// If there are no taskfiles, return an empty array
41-
if (!this._taskfiles) {
41+
if (!this._taskfiles || this._taskfiles.length === 0) {
4242
return Promise.resolve([]);
4343
}
4444

src/task.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@ export class TaskExtension {
1212
constructor() {
1313
this._activityBar = new elements.ActivityBar();
1414
this._watcher = vscode.workspace.createFileSystemWatcher("**/*.{yml,yaml}");
15-
services.taskfile.checkInstallation().then(status => {
16-
vscode.commands.executeCommand('setContext', 'vscode-task:status', status);
17-
});
1815
this.setTreeNesting(settings.treeNesting);
1916
}
2017

2118
public async update(): Promise<void> {
22-
let p: Promise<models.Taskfile>[] = [];
23-
vscode.workspace.workspaceFolders?.forEach((folder) => {
24-
p.push(services.taskfile.read(folder.uri.fsPath));
25-
});
26-
await Promise.all(p).then((taskfiles: models.Taskfile[]) => {
19+
// Do version checks
20+
await services.taskfile.checkInstallation().then((status): Promise<models.Taskfile[]> => {
21+
vscode.commands.executeCommand('setContext', 'vscode-task:status', status);
22+
if (status === "ready") {
23+
// Read taskfiles
24+
let p: Promise<models.Taskfile>[] = [];
25+
vscode.workspace.workspaceFolders?.forEach((folder) => {
26+
p.push(services.taskfile.read(folder.uri.fsPath));
27+
});
28+
return Promise.all(p);
29+
}
30+
return Promise.resolve([]);
31+
}).then((taskfiles: models.Taskfile[]) => {
2732
this._taskfiles = taskfiles;
2833
});
2934
}

0 commit comments

Comments
 (0)