refactor: update names, load defaults from package.json

This commit is contained in:
2026-07-15 16:02:30 +05:00
parent 9b27e94d04
commit 4539d39576
13 changed files with 146 additions and 79 deletions
+13 -6
View File
@@ -1,5 +1,6 @@
import * as path from "path";
import * as vscode from "vscode";
import { getConfigSection, getSettingDefault } from "@/config";
import { IConfigProvider } from "@/ports";
export class VscodeConfigProvider implements IConfigProvider {
@@ -7,18 +8,24 @@ export class VscodeConfigProvider implements IConfigProvider {
const workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
if (!workspaceRoot) return undefined;
const config = vscode.workspace.getConfiguration("xboctFlow");
const relativePath = config.get<string>("projectPath") ?? ".vscode/tasks";
const config = vscode.workspace.getConfiguration(getConfigSection());
// get() already merges package.json defaults; fallback for safety.
const relativePath =
config.get<string>("projectPath") ?? getSettingDefault("projectPath");
return path.join(workspaceRoot, relativePath);
}
getGlobalTaskPath(): string | undefined {
const config = vscode.workspace.getConfiguration("xboctFlow");
return config.get<string>("globalPath") || undefined;
const config = vscode.workspace.getConfiguration(getConfigSection());
const globalPath =
config.get<string>("globalPath") ?? getSettingDefault("globalPath");
return globalPath || undefined;
}
getFileExtension(): string {
const config = vscode.workspace.getConfiguration("xboctFlow");
return config.get<string>("fileExtension") ?? ".task.md";
const config = vscode.workspace.getConfiguration(getConfigSection());
return (
config.get<string>("fileExtension") ?? getSettingDefault("fileExtension")
);
}
}