feat: add wirings - view and ui

This commit is contained in:
2026-07-14 10:05:00 +05:00
parent 3490781ad5
commit cbb97a99ce
9 changed files with 344 additions and 107 deletions
+16 -47
View File
@@ -3,30 +3,27 @@ import * as vscode from "vscode";
import { FsTaskRepository } from "@/storage/FsTaskRepository";
import { NodeFileSystem } from "@/storage/NodeFileSystem";
import { VscodeConfigProvider } from "@/storage/VscodeConfigProvider";
import { registerTaskCommands } from "@/ui/taskCommands";
import { TaskTreeProvider } from "@/views/taskTreeProvider";
export function activate(context: vscode.ExtensionContext) {
const fileSystem = new NodeFileSystem();
const configStore = new VscodeConfigProvider();
const taskStore = new FsTaskRepository(
fileSystem,
configStore.getFileExtension(),
);
const taskTreeProvider = new TaskTreeProvider(taskStore, configStore);
const config = new VscodeConfigProvider();
const repo = new FsTaskRepository(fileSystem, config.getFileExtension());
const tree = new TaskTreeProvider(repo, config);
vscode.window.registerTreeDataProvider(
"projectTasks.tasks",
taskTreeProvider,
context.subscriptions.push(
vscode.window.registerTreeDataProvider("projectTasks.tasks", tree),
);
const projectPath = configStore.getProjectTaskPath();
const projectPath = config.getProjectTaskPath();
if (projectPath) {
const ext = configStore.getFileExtension();
const ext = config.getFileExtension();
const taskPattern = path.join(projectPath, `*${ext}`).replace(/\\/g, "/");
const watcher = vscode.workspace.createFileSystemWatcher(taskPattern);
watcher.onDidCreate(() => taskTreeProvider.refresh());
watcher.onDidChange(() => taskTreeProvider.refresh());
watcher.onDidDelete(() => taskTreeProvider.refresh());
watcher.onDidCreate(() => tree.refresh());
watcher.onDidChange(() => tree.refresh());
watcher.onDidDelete(() => tree.refresh());
context.subscriptions.push(watcher);
}
@@ -39,41 +36,13 @@ export function activate(context: vscode.ExtensionContext) {
statusBarItem.show();
context.subscriptions.push(statusBarItem);
const createTaskCommand = vscode.commands.registerCommand(
"projectTasks.createTask",
async () => {
const title = await vscode.window.showInputBox({
prompt: "Task title",
placeHolder: "Enter task title...",
});
if (!title) return;
registerTaskCommands(context, { repo, config, tree });
const projectPath = configStore.getProjectTaskPath();
if (!projectPath) {
vscode.window.showErrorMessage("Open a workspace folder first");
return;
}
await taskStore.create(projectPath, {
title,
description: "",
status: "todo",
priority: "medium",
tags: [],
assignee: "",
});
vscode.window.showInformationMessage(`Task created: ${title}`);
},
context.subscriptions.push(
vscode.commands.registerCommand("projectTasks.openDashboard", () => {
void vscode.window.showInformationMessage("Dashboard coming soon!");
}),
);
const openDashboardCommand = vscode.commands.registerCommand(
"projectTasks.openDashboard",
() => {
vscode.window.showInformationMessage("Dashboard coming soon!");
},
);
context.subscriptions.push(createTaskCommand, openDashboardCommand);
}
export function deactivate() {}