Skip to content

Commit

Permalink
fix detection of unset path options
Browse files Browse the repository at this point in the history
`zig.path` and `zig.zls.path` default to an empty string instead of null
when unset so the previous check would skip the initial setup.
Unfortunately this makes it impossible to differentiate between an unset
path and lookup in $PATH.
  • Loading branch information
Techatrix authored and Vexu committed Apr 2, 2024
1 parent de6d00c commit b7369a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"scope": "machine-overridable",
"type": "string",
"default": "",
"description": "Path to `zls` executable. Example: `C:/zls/zig-cache/bin/zls.exe`.",
"description": "Path to `zls` executable. Example: `C:/zls/zig-cache/bin/zls.exe`. Empty string will lookup ZLS in PATH.",
"format": "path"
},
"zig.zls.enableSnippets": {
Expand Down
4 changes: 2 additions & 2 deletions src/zigSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export async function setupZig(context: vscode.ExtensionContext) {
async function initialSetup(context: vscode.ExtensionContext): Promise<boolean> {
const zigConfig = vscode.workspace.getConfiguration("zig");

if (!zigConfig.has("path")) {
if (zigConfig.get<string>("path") === "") {
const zigResponse = await vscode.window.showInformationMessage(
"Zig path hasn't been set, do you want to specify the path or install Zig?",
{ modal: true },
Expand Down Expand Up @@ -277,7 +277,7 @@ async function initialSetup(context: vscode.ExtensionContext): Promise<boolean>

const zlsConfig = vscode.workspace.getConfiguration("zig.zls");

if (!zlsConfig.has("path")) {
if (zlsConfig.get<string>("path") === "") {
const zlsResponse = await vscode.window.showInformationMessage(
"We recommend enabling ZLS (the Zig Language Server) for a better editing experience. Would you like to install it?",
{ modal: true },
Expand Down

0 comments on commit b7369a4

Please sign in to comment.