feat: update tag workflow

This commit is contained in:
2026-07-18 06:57:52 +05:00
parent 6eedfb2bc5
commit 9b1281ce49
10 changed files with 134 additions and 25 deletions
+19 -14
View File
@@ -343,18 +343,18 @@ export async function runEditTaskTags(
catalogSet.add(tag);
}
const ok = await applyTags(document, selected);
if (ok) {
void vscode.window.showInformationMessage(
selected.length ? `Tags: ${selected.join(", ")}` : "Tags cleared",
);
}
await applyTags(document, selected);
}
/** Add unknown task tags into the task-folder config.yml. */
/**
* Add tag(s) to task-folder config.yml.
* Prefer `tagArg` from Code Action on an unknown-tag warning.
* Without tag: multi-select remaining unknown tags from the task.
*/
export async function runAddTagToProject(
deps: FrontmatterEditDeps,
uriArg?: string,
tagArg?: string,
): Promise<void> {
const document = await resolveDocument(uriArg);
if (!document) {
@@ -372,6 +372,18 @@ export async function runAddTagToProject(
return;
}
const single = normalizeTag(tagArg ?? "");
if (single) {
const result = await addProjectTag(deps.fs, {
folderPath: folder,
tag: single,
});
if (result.isErr()) {
presentError(result.error);
}
return;
}
const loaded = await loadProjectConfig(deps.fs, folder);
if (loaded.isErr()) {
presentError(loaded.error);
@@ -383,9 +395,6 @@ export async function runAddTagToProject(
const unknown = current.filter((tag) => !known.has(tag));
if (unknown.length === 0) {
void vscode.window.showInformationMessage(
"All task tags are already in project config",
);
return;
}
@@ -412,8 +421,4 @@ export async function runAddTagToProject(
return;
}
}
void vscode.window.showInformationMessage(
`Added to project config: ${picked.map((p) => p.tag).join(", ")}`,
);
}