✨feature: Add completion percentage and bar to phase titles
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user