Skip to content

Commit 4fb8a7e

Browse files
Formatting
1 parent 6c92c47 commit 4fb8a7e

3 files changed

Lines changed: 11 additions & 39 deletions

File tree

src/discovery/mise.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ export const CATEGORY_DEF: CategoryDef = {
2121
/**
2222
* Discovers Mise tasks from mise configuration files.
2323
*/
24-
export async function discoverMiseTasks(
25-
workspaceRoot: string,
26-
excludePatterns: string[]
27-
): Promise<CommandItem[]> {
24+
export async function discoverMiseTasks(workspaceRoot: string, excludePatterns: string[]): Promise<CommandItem[]> {
2825
const exclude = `{${excludePatterns.join(",")}}`;
2926

3027
// Mise supports: mise.toml, .mise.toml, mise.yaml, .mise.yaml
@@ -48,9 +45,8 @@ export async function discoverMiseTasks(
4845
const miseDir = path.dirname(file.fsPath);
4946
const category = simplifyPath(file.fsPath, workspaceRoot);
5047

51-
const tasks = file.fsPath.endsWith(".yaml") || file.fsPath.endsWith(".yml")
52-
? parseMiseYaml(content)
53-
: parseMiseToml(content);
48+
const tasks =
49+
file.fsPath.endsWith(".yaml") || file.fsPath.endsWith(".yml") ? parseMiseYaml(content) : parseMiseToml(content);
5450

5551
for (const task of tasks) {
5652
const taskCommand: MutableCommandItem = {

src/test/unit/discovery.unit.test.ts

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,14 @@ suite("PowerShell Parser Unit Tests", () => {
154154
});
155155

156156
test("parses tasks with [tasks] preamble", () => {
157-
const content = [
158-
"[tasks]",
159-
"[tasks.build]",
160-
'run = "cargo build"',
161-
].join("\n");
157+
const content = ["[tasks]", "[tasks.build]", 'run = "cargo build"'].join("\n");
162158
const tasks = parseMiseToml(content);
163159
assert.strictEqual(tasks.length, 1);
164160
assert.strictEqual(tasks[0]?.name, "build");
165161
});
166162

167163
test("extracts description", () => {
168-
const content = [
169-
"[tasks.deploy]",
170-
'description = "Deploy to production"',
171-
'run = "deploy.sh"',
172-
].join("\n");
164+
const content = ["[tasks.deploy]", 'description = "Deploy to production"', 'run = "deploy.sh"'].join("\n");
173165
const tasks = parseMiseToml(content);
174166
assert.strictEqual(tasks.length, 1);
175167
assert.strictEqual(tasks[0]?.description, "Deploy to production");
@@ -193,47 +185,30 @@ suite("PowerShell Parser Unit Tests", () => {
193185
});
194186

195187
test("returns empty for no tasks", () => {
196-
const content = [
197-
"[tools]",
198-
'go = "latest"',
199-
].join("\n");
188+
const content = ["[tools]", 'go = "latest"'].join("\n");
200189
const tasks = parseMiseToml(content);
201190
assert.strictEqual(tasks.length, 0);
202191
});
203192
});
204193

205194
suite("parseMiseYaml", () => {
206195
test("parses task names under tasks key", () => {
207-
const content = [
208-
"tasks:",
209-
" lint:",
210-
" run: golangci-lint run",
211-
" test:",
212-
" run: gotestsum",
213-
].join("\n");
196+
const content = ["tasks:", " lint:", " run: golangci-lint run", " test:", " run: gotestsum"].join("\n");
214197
const tasks = parseMiseYaml(content);
215198
assert.strictEqual(tasks.length, 2);
216199
assert.strictEqual(tasks[0]?.name, "lint");
217200
assert.strictEqual(tasks[1]?.name, "test");
218201
});
219202

220203
test("extracts description", () => {
221-
const content = [
222-
"tasks:",
223-
" deploy:",
224-
' description: "Deploy to prod"',
225-
" run: deploy.sh",
226-
].join("\n");
204+
const content = ["tasks:", " deploy:", ' description: "Deploy to prod"', " run: deploy.sh"].join("\n");
227205
const tasks = parseMiseYaml(content);
228206
assert.strictEqual(tasks.length, 1);
229207
assert.strictEqual(tasks[0]?.description, "Deploy to prod");
230208
});
231209

232210
test("returns empty for no tasks", () => {
233-
const content = [
234-
"tools:",
235-
" go: latest",
236-
].join("\n");
211+
const content = ["tools:", " go: latest"].join("\n");
237212
const tasks = parseMiseYaml(content);
238213
assert.strictEqual(tasks.length, 0);
239214
});

src/watchers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from "vscode";
22

3-
const TASK_FILE_PATTERN = "**/{package.json,Makefile,makefile,tasks.json,launch.json,*.sh,*.py,mise.toml,.mise.toml,mise.yaml,.mise.yaml}";
3+
const TASK_FILE_PATTERN =
4+
"**/{package.json,Makefile,makefile,tasks.json,launch.json,*.sh,*.py,mise.toml,.mise.toml,mise.yaml,.mise.yaml}";
45
const CONFIG_FILE_PATTERN = "**/.vscode/commandtree.json";
56
const TASK_DEBOUNCE_MS = 2000;
67
const CONFIG_DEBOUNCE_MS = 1000;

0 commit comments

Comments
 (0)