Skip to content

Commit 34db6a0

Browse files
TechatrixVexu
authored andcommitted
fix zig.buildOnSaveArgs config option not being sent over to ZLS
1 parent cbcbfa8 commit 34db6a0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/zls.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ function configurationMiddleware(params: ConfigurationParams): LSPAny[] | Respon
173173
if (typeof value === "string") {
174174
// Make sure that `""` gets converted to `undefined` and resolve predefined values
175175
value = value ? zigUtil.handleConfigOption(value, workspaceFolder ?? "guess") : undefined;
176-
} else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
176+
} else if (Array.isArray(value)) {
177+
value = value.map((elem: unknown) => {
178+
if (typeof elem !== "string") return elem;
179+
return zigUtil.handleConfigOption(elem, workspaceFolder ?? "guess");
180+
});
181+
} else if (typeof value === "object" && value !== null) {
177182
// Recursively update the config options
178183
const newValue: Record<string, unknown> = {};
179184
for (const [fieldName, fieldValue] of Object.entries(value)) {
@@ -212,9 +217,11 @@ function configurationMiddleware(params: ConfigurationParams): LSPAny[] | Respon
212217

213218
switch (configuration.get<"off" | "auto" | "extension" | "zls">("buildOnSaveProvider", "auto")) {
214219
case "auto":
220+
additionalOptions["buildOnSaveArgs"] = configuration.get("buildOnSaveArgs");
215221
break;
216222
case "zls":
217223
additionalOptions["enableBuildOnSave"] = true;
224+
additionalOptions["buildOnSaveArgs"] = configuration.get("buildOnSaveArgs");
218225
break;
219226
case "off":
220227
case "extension":

0 commit comments

Comments
 (0)