Skip to content

Commit

Permalink
fix checks for unset config values
Browse files Browse the repository at this point in the history
`get` returns `undefined` for unset - `not `null`
  • Loading branch information
Vexu committed Feb 6, 2024
1 parent c1bb70f commit fcc5802
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/zls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ export async function activate(context: ExtensionContext) {
outputChannel = window.createOutputChannel("Zig Language Server");

vscode.commands.registerCommand("zig.zls.install", async () => {
const zigPath = workspace.getConfiguration("zig").get<string | null>("path");
if (zigPath === null) {
if (!workspace.getConfiguration("zig").get<string>("path")) {
window.showErrorMessage("This command cannot be run without setting 'zig.path'.", { modal: true });
return;
}
Expand Down Expand Up @@ -289,9 +288,9 @@ export async function activate(context: ExtensionContext) {
});

const zigConfig = vscode.workspace.getConfiguration("zig");
if (zigConfig.get<string | null>("path") === null) return;
if (!zigConfig.get<string>("path")) return;
const zlsConfig = workspace.getConfiguration("zig.zls");
if (zlsConfig.get<string | null>("path") === null) return;
if (!zlsConfig.get<string>("path")) return;
if (zlsConfig.get<boolean>("checkForUpdate") && shouldCheckUpdate(context, "zlsUpdate")) {
await checkUpdate(context);
}
Expand Down

0 comments on commit fcc5802

Please sign in to comment.