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

Commit 5e37e61

Browse files
committed
ZLS has deprecated --enable-debug-log in favor of --log-level
It is expected to be removed in ZLS 0.14.0
1 parent b877fda commit 5e37e61

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/zls.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function restartClient(context: vscode.ExtensionContext): Promise<v
3737
if (!result) return;
3838

3939
try {
40-
const newClient = await startClient(result.exe);
40+
const newClient = await startClient(result.exe, result.version);
4141
await stopClient();
4242
client = newClient;
4343
} catch (reason) {
@@ -49,13 +49,25 @@ export async function restartClient(context: vscode.ExtensionContext): Promise<v
4949
}
5050
}
5151

52-
async function startClient(zlsPath: string): Promise<LanguageClient> {
52+
async function startClient(zlsPath: string, zlsVersion: semver.SemVer): Promise<LanguageClient> {
5353
const configuration = vscode.workspace.getConfiguration("zig.zls");
5454
const debugLog = configuration.get<boolean>("debugLog", false);
5555

56+
const args: string[] = [];
57+
58+
if (debugLog) {
59+
/** `--enable-debug-log` has been deprecated in favor of `--log-level`. https://github.com/zigtools/zls/pull/1957 */
60+
const zlsCLIRevampVersion = new semver.SemVer("0.14.0-50+3354fdc");
61+
if (semver.lt(zlsVersion, zlsCLIRevampVersion)) {
62+
args.push("--enable-debug-log");
63+
} else {
64+
args.push("--log-level", "debug");
65+
}
66+
}
67+
5668
const serverOptions: ServerOptions = {
5769
command: zlsPath,
58-
args: debugLog ? ["--enable-debug-log"] : [],
70+
args: args,
5971
};
6072

6173
const clientOptions: LanguageClientOptions = {

0 commit comments

Comments
 (0)