feat: add sidebar panel
This commit is contained in:
@@ -1,10 +1,28 @@
|
||||
import * as path from "path";
|
||||
import * as vscode from "vscode";
|
||||
import { ConfigStore } from "./storage/configStore";
|
||||
import { TaskStore } from "./storage/taskStore";
|
||||
import { TaskTreeProvider } from "./views/taskTreeProvider";
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
const taskStore = new TaskStore();
|
||||
const configStore = new ConfigStore();
|
||||
const taskTreeProvider = new TaskTreeProvider();
|
||||
|
||||
vscode.window.registerTreeDataProvider(
|
||||
"projectTasks.tasks",
|
||||
taskTreeProvider,
|
||||
);
|
||||
|
||||
const projectPath = configStore.getProjectTaskPath();
|
||||
if (projectPath) {
|
||||
const taskPattern = path.join(projectPath, "*.task.md").replace(/\\/g, "/");
|
||||
const watcher = vscode.workspace.createFileSystemWatcher(taskPattern);
|
||||
watcher.onDidCreate(() => taskTreeProvider.refresh());
|
||||
watcher.onDidChange(() => taskTreeProvider.refresh());
|
||||
watcher.onDidDelete(() => taskTreeProvider.refresh());
|
||||
context.subscriptions.push(watcher);
|
||||
}
|
||||
|
||||
const statusBarItem = vscode.window.createStatusBarItem(
|
||||
vscode.StatusBarAlignment.Left,
|
||||
|
||||
Reference in New Issue
Block a user