This repository was archived by the owner on Nov 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff 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 = {
You can’t perform that action at this time.
0 commit comments