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/CHANGELOG.md | 3 ++- Zig.novaextension/NOTICES.md | 4 ++-- Zig.novaextension/README.md | 2 +- Zig.novaextension/Scripts/main.js | 14 ++++++++------ Zig.novaextension/extension.json | 4 +++- 5 files changed, 16 insertions(+), 11 deletions(-) (limited to 'Zig.novaextension') diff --git a/Zig.novaextension/CHANGELOG.md b/Zig.novaextension/CHANGELOG.md index 3786150..88606ae 100644 --- a/Zig.novaextension/CHANGELOG.md +++ b/Zig.novaextension/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 0.2.0 — 2026-05-10 - Tasks now expose first-class config for `-Doptimize`, `-Dtarget`, and custom `-D=` user options on every template that takes them. - Added **Zig Test** template (`zig build test` with `--test-filter` and `--summary`). @@ -12,6 +12,7 @@ - Clean now refuses to run when the working directory is `/`, `$HOME`, or outside the workspace, and runs `zig build uninstall` first when the project exposes that step. - "Current Zig File" Clean walks up to the nearest `build.zig` instead of cleaning the file's directory. - Issue assistant no longer registers for the non-existent `zig-package` syntax. + ## 0.1.8 — 2026-05-07 - Added a setting to write an LLDB proxy log file for debugging the debug adapter. diff --git a/Zig.novaextension/NOTICES.md b/Zig.novaextension/NOTICES.md index 3ee7700..3ab0c1f 100644 --- a/Zig.novaextension/NOTICES.md +++ b/Zig.novaextension/NOTICES.md @@ -16,8 +16,8 @@ programming language logo, which is the work of the - `extension.png` - `extension@2x.png` -- `Images/zig-debug/zig-debug.png` -- `Images/zig-debug/zig-debug@2x.png` +- `Images/zig-mark/zig-mark.png` +- `Images/zig-mark/zig-mark@2x.png` - `Resources/Zig@32px.af` These assets remain licensed under CC BY-SA 4.0; redistribution must diff --git a/Zig.novaextension/README.md b/Zig.novaextension/README.md index 3741954..f4516ef 100644 --- a/Zig.novaextension/README.md +++ b/Zig.novaextension/README.md @@ -109,7 +109,7 @@ code carry their own licenses, documented in [`NOTICES.md`](NOTICES.md): - The Zig logo and the icon/image assets derived from it - (`extension.png`, `extension@2x.png`, `Images/zig-debug/*.png`, + (`extension.png`, `extension@2x.png`, `Images/zig-mark/*.png`, `Resources/Zig@32px.af`) are the work of the [Zig Software Foundation](https://ziglang.org) and remain licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). 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))); } diff --git a/Zig.novaextension/extension.json b/Zig.novaextension/extension.json index 34a9d02..f63a7b8 100644 --- a/Zig.novaextension/extension.json +++ b/Zig.novaextension/extension.json @@ -2,7 +2,7 @@ "identifier": "at.dcz.nova-zig", "organization": "David Czihak", "name": "Zig", - "version": "0.1.8", + "version": "0.2.0", "license": "BSD-2-Clause", "description": "Zig language support – ZLS, LLDB, Tree-Sitter grammar", @@ -566,6 +566,8 @@ "key": "debounceMs", "title": "Debounce (ms)", "type": "number", + "min": 0, + "max": 60000, "description": "Passed as `--debounce `. Leave blank for Zig's default." }, { -- cgit v1.3