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 @@ -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 = {
You can’t perform that action at this time.
0 commit comments