From 82901bb223b3592b847099d245495decfa0474c3 Mon Sep 17 00:00:00 2001 From: David Czihak Date: Sun, 10 May 2026 19:24:37 +0200 Subject: Fix: Code review fixes and 0.2.0 release prep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - localizeText: return fallback when localization key is missing instead of a developer-facing "Localization missing for X" message - resolveCleanPaths: remove dead `normalized === ""` branch (unreachable after the preceding absolute-path guard) - resolveBuildStepAction: validate step before the async resolveZigExecutable call to avoid a pointless `which zig` subprocess on invalid input - buildShellCommand: join cd + command with `&&` instead of `;` so a failed cd aborts instead of running the command in the wrong directory - resolveWatchAction: cap debounceMs at 60 000; add min/max to schema - USER_OPTION_REGEX: tighten =.* to =.+ to reject empty option values - Bump version to 0.2.0 - Finalize CHANGELOG for 0.2.0 — 2026-05-10 - NOTICES/README: update zig-debug → zig-mark asset references - ISSUES.md: mark A1–A6 fixed, update all file paths to Zig.novaextension/ Co-Authored-By: Claude Sonnet 4.6 --- Zig.novaextension/Scripts/main.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Zig.novaextension/Scripts/main.js') 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))); } -- cgit v1.3