aboutsummaryrefslogtreecommitdiff
path: root/Zig.novaextension/Scripts
diff options
context:
space:
mode:
authorDavid Czihak <git@dcz.at>2026-05-10 19:24:37 +0200
committerDavid Czihak <git@dcz.at>2026-05-10 19:24:37 +0200
commit82901bb223b3592b847099d245495decfa0474c3 (patch)
treeccfd2a64e3db1f160ee5344f6bcc0d12fdb8696a /Zig.novaextension/Scripts
parentb80b9c1f82585677a7c042557576c41b1670d259 (diff)
Fix: Code review fixes and 0.2.0 release prep
- 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 <noreply@anthropic.com>
Diffstat (limited to 'Zig.novaextension/Scripts')
-rw-r--r--Zig.novaextension/Scripts/main.js14
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)));
}