Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 262b663

Browse files
committed
add buttons to the error message when Zig could not be found
Similar to #412 but for the 'zig.path' option.
1 parent 0dbb0fe commit 262b663

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/zigProvider.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,24 @@ export class ZigProvider {
5858
if (!zigPath) return null;
5959
const result = resolveExePathAndVersion(zigPath, "version");
6060
if ("message" in result) {
61-
void vscode.window.showErrorMessage(`Unexpected 'zig.path': ${result.message}`);
61+
vscode.window
62+
.showErrorMessage(`Unexpected 'zig.path': ${result.message}`, "install Zig", "open settings")
63+
.then(async (response) => {
64+
switch (response) {
65+
case "install Zig":
66+
await workspaceConfigUpdateNoThrow(
67+
vscode.workspace.getConfiguration("zig"),
68+
"path",
69+
undefined,
70+
);
71+
break;
72+
case "open settings":
73+
await vscode.commands.executeCommand("workbench.action.openSettings", "zig.path");
74+
break;
75+
case undefined:
76+
break;
77+
}
78+
});
6279
return undefined;
6380
}
6481
return result;

0 commit comments

Comments
 (0)