diff --git a/package.json b/package.json index f3d9d94..7aa3378 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ ], "activationEvents": [ "onStartupFinished", - "onView:roadmapChecklist", "workspaceContains:Development Checklist.md" ], "main": "./dist/extension.js", diff --git a/src/roadmapTree.ts b/src/roadmapTree.ts index 9831717..f550e53 100644 --- a/src/roadmapTree.ts +++ b/src/roadmapTree.ts @@ -1,15 +1,34 @@ import * as vscode from 'vscode'; export class RoadmapItem extends vscode.TreeItem { + public children: RoadmapItem[] = []; + constructor( public readonly label: string, public readonly collapsibleState: vscode.TreeItemCollapsibleState, - public readonly checked: boolean = false, - public readonly children: RoadmapItem[] = [] + public readonly checked: boolean = false ) { 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 } } + // After building all children, update phase progress + for (const phase of items) { + phase.updatePhaseInfo(); + } + return items; } }