style: formatting
This commit is contained in:
+2
-2
@@ -137,8 +137,8 @@ tags:
|
||||
- frontend
|
||||
```
|
||||
|
||||
Если `config.yml` есть, теги вне каталога — warning (Quick Fix: **Add tag "…"
|
||||
to project**). Hover на `tags` → **Edit tags…**.
|
||||
Если `config.yml` есть, теги вне каталога — warning (Quick Fix: **Add tag "…" to
|
||||
project**). Hover на `tags` → **Edit tags…**.
|
||||
|
||||
## Dashboard
|
||||
|
||||
|
||||
@@ -59,7 +59,10 @@ describe("buildDashboardView", () => {
|
||||
});
|
||||
|
||||
expect(view.visibleTasks.map((t) => t.id)).toEqual(["1", "3"]);
|
||||
expect(view.groups.map((g) => g.key)).toEqual([TaskPriority.HIGH, TaskPriority.MEDIUM]);
|
||||
expect(view.groups.map((g) => g.key)).toEqual([
|
||||
TaskPriority.HIGH,
|
||||
TaskPriority.MEDIUM,
|
||||
]);
|
||||
});
|
||||
|
||||
it("resolves selected task by id from the full task list", () => {
|
||||
|
||||
@@ -63,12 +63,16 @@ describe("filterTasks", () => {
|
||||
});
|
||||
|
||||
it("filters by multiple statuses", () => {
|
||||
const result = filterTasks(tasks, { statuses: [TaskStatus.OPEN, TaskStatus.DONE] });
|
||||
const result = filterTasks(tasks, {
|
||||
statuses: [TaskStatus.OPEN, TaskStatus.DONE],
|
||||
});
|
||||
expect(result.map((t) => t.id)).toEqual(["1", "3", "4"]);
|
||||
});
|
||||
|
||||
it("filters by priority", () => {
|
||||
const result = filterTasks(tasks, { priorities: [TaskPriority.HIGH, TaskPriority.CRITICAL] });
|
||||
const result = filterTasks(tasks, {
|
||||
priorities: [TaskPriority.HIGH, TaskPriority.CRITICAL],
|
||||
});
|
||||
expect(result.map((t) => t.id)).toEqual(["1", "4"]);
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,11 @@ describe("replaceFrontmatterField", () => {
|
||||
});
|
||||
|
||||
it("replaces priority value", () => {
|
||||
const result = replaceFrontmatterField(sample, "priority", TaskPriority.CRITICAL);
|
||||
const result = replaceFrontmatterField(
|
||||
sample,
|
||||
"priority",
|
||||
TaskPriority.CRITICAL,
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) return;
|
||||
expect(result.content).toContain("priority: critical");
|
||||
@@ -60,9 +64,7 @@ describe("findFieldRange", () => {
|
||||
describe("formatTagsYamlValue", () => {
|
||||
it("formats empty and simple lists", () => {
|
||||
expect(formatTagsYamlValue([])).toBe("[]");
|
||||
expect(formatTagsYamlValue(["bug", "frontend"])).toBe(
|
||||
"[bug, frontend]",
|
||||
);
|
||||
expect(formatTagsYamlValue(["bug", "frontend"])).toBe("[bug, frontend]");
|
||||
});
|
||||
|
||||
it("quotes tags with spaces", () => {
|
||||
@@ -118,9 +120,7 @@ describe("extractFrontmatterBlock", () => {
|
||||
});
|
||||
|
||||
it("handles --- with trailing whitespace", () => {
|
||||
const block = extractFrontmatterBlock(
|
||||
"--- \ntitle: Hello\n--- \nbody",
|
||||
);
|
||||
const block = extractFrontmatterBlock("--- \ntitle: Hello\n--- \nbody");
|
||||
expect(block).not.toBeNull();
|
||||
expect(block!.yaml).toBe("title: Hello");
|
||||
expect(block!.closeLine).toBe(2);
|
||||
|
||||
@@ -19,7 +19,9 @@ function escapeRegExp(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
export function extractFrontmatterBlock(content: string): FrontmatterBlock | null {
|
||||
export function extractFrontmatterBlock(
|
||||
content: string,
|
||||
): FrontmatterBlock | null {
|
||||
const NOT_FOUND = -1;
|
||||
const lines = content.split(/\r?\n/);
|
||||
if (lines.length === 0 || lines[0].trim() !== "---") {
|
||||
@@ -62,7 +64,10 @@ export function extractFrontmatterBlock(content: string): FrontmatterBlock | nul
|
||||
};
|
||||
}
|
||||
|
||||
export function findFieldRange(content: string, key: string): TextRange | undefined {
|
||||
export function findFieldRange(
|
||||
content: string,
|
||||
key: string,
|
||||
): TextRange | undefined {
|
||||
const block = extractFrontmatterBlock(content);
|
||||
if (!block || block.closeLine < 0) {
|
||||
return block?.range;
|
||||
|
||||
@@ -13,9 +13,7 @@ describe("projectConfig model", () => {
|
||||
|
||||
it("joins folder path with config.yml", () => {
|
||||
expect(getProjectConfigPath("/ws/.xflow")).toBe("/ws/.xflow/config.yml");
|
||||
expect(getProjectConfigPath("C:\\proj\\.xflow")).toMatch(
|
||||
/config\.yml$/,
|
||||
);
|
||||
expect(getProjectConfigPath("C:\\proj\\.xflow")).toMatch(/config\.yml$/);
|
||||
});
|
||||
|
||||
it("empty config has no tags", () => {
|
||||
|
||||
@@ -23,9 +23,7 @@ export function parseProjectConfig(
|
||||
data = yaml.load(content);
|
||||
} catch (error) {
|
||||
const detail = error instanceof Error ? error.message : "invalid YAML";
|
||||
return err(
|
||||
appError(AppErrorVariant.INVALID_PROJECT_CONFIG, { detail }),
|
||||
);
|
||||
return err(appError(AppErrorVariant.INVALID_PROJECT_CONFIG, { detail }));
|
||||
}
|
||||
|
||||
if (data === null || data === undefined) {
|
||||
|
||||
@@ -279,9 +279,7 @@ export async function runEditTaskTags(
|
||||
seen.add(tag);
|
||||
items.push({
|
||||
label: tag,
|
||||
description: catalog.includes(tag)
|
||||
? undefined
|
||||
: "will add to config",
|
||||
description: catalog.includes(tag) ? undefined : "will add to config",
|
||||
tag,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ describe("resolveTaskFolderForPath", () => {
|
||||
{ scope: TaskScope.PROJECT, folderPath: "/ws" },
|
||||
{ scope: TaskScope.GLOBAL, folderPath: "/ws/.xflow" },
|
||||
];
|
||||
expect(
|
||||
resolveTaskFolderForPath("/ws/.xflow/a.xflow.md", nested),
|
||||
).toBe("/ws/.xflow");
|
||||
expect(resolveTaskFolderForPath("/ws/.xflow/a.xflow.md", nested)).toBe(
|
||||
"/ws/.xflow",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -58,8 +58,7 @@ export function registerTaskCodeActions(
|
||||
selector,
|
||||
new TaskCodeActionProvider(),
|
||||
{
|
||||
providedCodeActionKinds:
|
||||
TaskCodeActionProvider.providedCodeActionKinds,
|
||||
providedCodeActionKinds: TaskCodeActionProvider.providedCodeActionKinds,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -268,11 +268,7 @@ export function registerTaskCommands(
|
||||
vscode.commands.registerCommand(
|
||||
"xboctukFlow.addTagToProject",
|
||||
(uri?: string, tag?: string) =>
|
||||
runAddTagToProject(
|
||||
{ fs: deps.fs, config: deps.config },
|
||||
uri,
|
||||
tag,
|
||||
),
|
||||
runAddTagToProject({ fs: deps.fs, config: deps.config }, uri, tag),
|
||||
),
|
||||
vscode.commands.registerCommand("xboctukFlow.openDashboard", () =>
|
||||
runOpenDashboard(deps),
|
||||
|
||||
@@ -19,7 +19,11 @@ export function unknownTagDiagnosticCode(tag: string): string {
|
||||
}
|
||||
|
||||
export function parseUnknownTagFromDiagnosticCode(
|
||||
code: string | number | { value: string | number; target: vscode.Uri } | undefined,
|
||||
code:
|
||||
| string
|
||||
| number
|
||||
| { value: string | number; target: vscode.Uri }
|
||||
| undefined,
|
||||
): string | undefined {
|
||||
const raw =
|
||||
typeof code === "string"
|
||||
|
||||
Reference in New Issue
Block a user