fix: update side panel on update settings

This commit is contained in:
2026-07-18 08:09:18 +05:00
parent 2ef7c2b55e
commit 9e63a41a20
4 changed files with 95 additions and 74 deletions
+34 -10
View File
@@ -5,6 +5,7 @@ import { TASK_FILE_EXTENSION } from "@/model/taskFile";
import { FsTaskRepository } from "@/storage/FsTaskRepository";
import { NodeFileSystem } from "@/storage/NodeFileSystem";
import { VscodeConfigProvider } from "@/storage/VscodeConfigProvider";
import { IConfigProvider } from "@/ports";
import { registerTaskCodeActions } from "@/ui/taskCodeActions";
import { registerTaskCommands } from "@/ui/taskCommands";
import { registerTaskDecorations } from "@/ui/taskDecorations";
@@ -13,6 +14,24 @@ import { TaskDashboardPanel } from "@/views/taskDashboardPanel";
import { TaskKanbanPanel } from "@/views/taskKanbanPanel";
import { TaskTreeProvider } from "@/views/taskTreeProvider";
function createTaskWatchers(
config: IConfigProvider,
onMutated: () => void,
): vscode.Disposable {
return vscode.Disposable.from(
...resolveTaskLocations(config).map((location) => {
const pattern = path
.join(location.folderPath, `*${TASK_FILE_EXTENSION}`)
.replace(/\\/g, "/");
const watcher = vscode.workspace.createFileSystemWatcher(pattern);
watcher.onDidCreate(onMutated);
watcher.onDidChange(onMutated);
watcher.onDidDelete(onMutated);
return watcher;
}),
);
}
export function activate(context: vscode.ExtensionContext) {
const fileSystem = new NodeFileSystem();
const config = new VscodeConfigProvider();
@@ -29,16 +48,21 @@ export function activate(context: vscode.ExtensionContext) {
vscode.window.registerTreeDataProvider("xboctukFlow.tasks", tree),
);
for (const location of resolveTaskLocations(config)) {
const taskPattern = path
.join(location.folderPath, `*${TASK_FILE_EXTENSION}`)
.replace(/\\/g, "/");
const watcher = vscode.workspace.createFileSystemWatcher(taskPattern);
watcher.onDidCreate(onTasksMutated);
watcher.onDidChange(onTasksMutated);
watcher.onDidDelete(onTasksMutated);
context.subscriptions.push(watcher);
}
let watcherDisposable: vscode.Disposable = createTaskWatchers(
config,
onTasksMutated,
);
context.subscriptions.push(watcherDisposable);
context.subscriptions.push(
vscode.workspace.onDidChangeConfiguration((e) => {
if (!e.affectsConfiguration("xboctukFlow")) return;
watcherDisposable.dispose();
watcherDisposable = createTaskWatchers(config, onTasksMutated);
context.subscriptions.push(watcherDisposable);
tree.refresh();
}),
);
const statusBarItem = vscode.window.createStatusBarItem(
vscode.StatusBarAlignment.Left,