diff options
Diffstat (limited to 'Zig.novaextension/Scripts/main.js')
| -rw-r--r-- | Zig.novaextension/Scripts/main.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Zig.novaextension/Scripts/main.js b/Zig.novaextension/Scripts/main.js index 7477993..70e4169 100644 --- a/Zig.novaextension/Scripts/main.js +++ b/Zig.novaextension/Scripts/main.js @@ -6,7 +6,7 @@ const EXTENSION_ID = "at.dcz.nova-zig"; const TASK_ASSISTANT_ID = `${EXTENSION_ID}.tasks`; const LANGUAGE_CLIENT_ID = `${EXTENSION_ID}.zls`; const ISSUE_MATCHER = "zig.compiler"; -const USER_OPTION_REGEX = /^[A-Za-z_][A-Za-z0-9_-]*(=.*)?$/; +const USER_OPTION_REGEX = /^[A-Za-z_][A-Za-z0-9_-]*(=.+)?$/; const STEP_CACHE_TTL_MS = 5 * 60 * 1000; const CONFIG_KEYS = { @@ -304,7 +304,7 @@ function resolveCleanPaths(cwd) { } const normalized = nova.path.normalize(cwd); - if (normalized === "/" || normalized === "") { + if (normalized === "/") { showWarning(); return null; } @@ -543,7 +543,7 @@ function localizeText(key, fallback, variables) { let text = nova.localize(key, null); if (key === text) { - return `Localization missing for ${key}`; + return fallback !== undefined ? String(fallback) : key; } if (!variables || typeof variables !== "object") { @@ -845,7 +845,7 @@ function buildShellCommand(command, args, cwd) { " ", ), ); - return segments.join("; "); + return segments.join(" && "); } /** @@ -1419,11 +1419,13 @@ class ZigTaskAssistant { async resolveBuildStepAction(step) { console.log(`[${TASK_ASSISTANT_ID}] resolveBuildStepAction: step=${step}`); + if (!step || !/^[A-Za-z_][\w-]*$/.test(step)) return null; + const zigPath = await resolveZigExecutable(); if (!zigPath) return null; const cwd = nova.workspace.path || null; - if (!cwd || !step || !/^[A-Za-z_][\w-]*$/.test(step)) return null; + if (!cwd) return null; return this.createAction(zigPath, ["build", step], cwd); } @@ -1459,7 +1461,7 @@ class ZigTaskAssistant { const debounce = getTaskConfigValue(config, "debounceMs"); if (debounce !== null && debounce !== undefined && debounce !== "") { const n = Number(debounce); - if (Number.isFinite(n) && n >= 0) + if (Number.isFinite(n) && n >= 0 && n <= 60000) argv.push("--debounce", String(Math.floor(n))); } |
