From fd95050f0a7f3f4c1ff628796760b9e4a055b8fe Mon Sep 17 00:00:00 2001 From: Techatrix Date: Thu, 6 Feb 2025 03:00:30 +0100 Subject: [PATCH] don't send default config values to ZLS This will prevent config options set in the zls.json from being overridden with default values by the extension. VS Code, in their infinite wisdom, has chosen to default boolean config options to false and string options to an empty string (""), ensuring that null or undefined are never returned. See zigtools/zls#2135 --- src/zls.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/zls.ts b/src/zls.ts index f7f213d..317540b 100644 --- a/src/zls.ts +++ b/src/zls.ts @@ -178,6 +178,16 @@ async function configurationMiddleware( // Make sure that `""` gets converted to `null` and resolve predefined values result[index] = configValue ? handleConfigOption(configValue) : null; } + + const inspect = configuration.inspect(section); + const isDefaultValue = + configValue === inspect?.defaultValue && + inspect?.globalValue === undefined && + inspect?.workspaceValue === undefined && + inspect?.workspaceFolderValue === undefined; + if(isDefaultValue) { + result[index] = null; + } } const indexOfZigPath = optionIndices["zig.path"];