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

Commit a59bc53

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 ede609f commit a59bc53

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
@@ -36,7 +36,7 @@ export async function restartClient(context: vscode.ExtensionContext): Promise<v
3636
if (!result) return;
3737

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

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

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

6072
const clientOptions: LanguageClientOptions = {

0 commit comments

Comments
 (0)