feature: Add completion percentage and bar to phase titles

This commit is contained in:
Keith Solomon
2025-06-22 11:16:02 -05:00
parent 21a7e972f2
commit 0a768d1701
2 changed files with 28 additions and 5 deletions

View File

@@ -11,7 +11,6 @@
], ],
"activationEvents": [ "activationEvents": [
"onStartupFinished", "onStartupFinished",
"onView:roadmapChecklist",
"workspaceContains:Development Checklist.md" "workspaceContains:Development Checklist.md"
], ],
"main": "./dist/extension.js", "main": "./dist/extension.js",

View File

@@ -1,15 +1,34 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
export class RoadmapItem extends vscode.TreeItem { export class RoadmapItem extends vscode.TreeItem {
public children: RoadmapItem[] = [];
constructor( constructor(
public readonly label: string, public readonly label: string,
public readonly collapsibleState: vscode.TreeItemCollapsibleState, public readonly collapsibleState: vscode.TreeItemCollapsibleState,
public readonly checked: boolean = false, public readonly checked: boolean = false
public readonly children: RoadmapItem[] = []
) { ) {
super(label, collapsibleState); super(label, collapsibleState);
this.description = checked ? '✅ Done' : '';
this.iconPath = new vscode.ThemeIcon(checked ? 'check' : 'circle-large-outline'); // Only set icon/description for non-phase items here
if (collapsibleState === vscode.TreeItemCollapsibleState.None) {
this.iconPath = new vscode.ThemeIcon(checked ? 'check' : 'circle-large-outline');
}
}
// Call this after assigning children
updatePhaseInfo() {
if (this.children.length === 0) { return; }
const total = this.children.length;
const completed = this.children.filter(c => c.checked).length;
const percent = Math.round((completed / total) * 100);
const bar = '▓'.repeat(Math.floor(percent / 10)).padEnd(10, '░');
this.description = `${bar} ${percent}%`;
this.iconPath = new vscode.ThemeIcon(
completed === total ? 'check' : 'tasklist'
);
} }
} }
@@ -68,6 +87,11 @@ export class RoadmapTreeProvider implements vscode.TreeDataProvider<RoadmapItem>
} }
} }
// After building all children, update phase progress
for (const phase of items) {
phase.updatePhaseInfo();
}
return items; return items;
} }
} }