diff --git a/src/zls.ts b/src/zls.ts index 173a6e9..c5a2c6c 100644 --- a/src/zls.ts +++ b/src/zls.ts @@ -36,7 +36,7 @@ export async function restartClient(context: vscode.ExtensionContext): Promise { +async function startClient(zlsPath: string, zlsVersion: semver.SemVer): Promise { const configuration = vscode.workspace.getConfiguration("zig.zls"); const debugLog = configuration.get("debugLog", false); + const args: string[] = []; + + if (debugLog) { + /** `--enable-debug-log` has been deprecated in favor of `--log-level`. https://github.com/zigtools/zls/pull/1957 */ + const zlsCLIRevampVersion = new semver.SemVer("0.14.0-50+3354fdc"); + if (semver.lt(zlsVersion, zlsCLIRevampVersion)) { + args.push("--enable-debug-log"); + } else { + args.push("--log-level", "debug"); + } + } + const serverOptions: ServerOptions = { command: zlsPath, - args: debugLog ? ["--enable-debug-log"] : [], + args: args, }; const clientOptions: LanguageClientOptions = {