@@ -368,13 +368,23 @@ export class ShaderLanguageClient {
368368 }
369369 }
370370 private getClientOption ( ) {
371+ // Pass languages that should be enabled to server.
372+ let hlslSupported = vscode . workspace . getConfiguration ( "shader-validator" ) . get < boolean > ( "hlsl.enabled" ) ! ;
373+ let glslSupported = vscode . workspace . getConfiguration ( "shader-validator" ) . get < boolean > ( "glsl.enabled" ) ! ;
374+ let wgslSupported = vscode . workspace . getConfiguration ( "shader-validator" ) . get < boolean > ( "wgsl.enabled" ) ! ;
375+ let documentSelector = [ ] ;
376+ if ( hlslSupported ) {
377+ documentSelector . push ( { scheme : 'file' , language : 'hlsl' } ) ;
378+ }
379+ if ( glslSupported ) {
380+ documentSelector . push ( { scheme : 'file' , language : 'glsl' } ) ;
381+ }
382+ if ( wgslSupported ) {
383+ documentSelector . push ( { scheme : 'file' , language : 'wgsl' } ) ;
384+ }
371385 const clientOptions : LanguageClientOptions = {
372386 // Register the server for shader documents
373- documentSelector : [
374- { scheme : 'file' , language : 'hlsl' } ,
375- { scheme : 'file' , language : 'glsl' } ,
376- { scheme : 'file' , language : 'wgsl' } ,
377- ] ,
387+ documentSelector : documentSelector ,
378388 outputChannel : this . channel ? this . channel : undefined ,
379389 traceOutputChannel : this . channel ? this . channel : undefined ,
380390 middleware : getMiddleware ( ) ,
@@ -384,10 +394,26 @@ export class ShaderLanguageClient {
384394 return clientOptions ;
385395 }
386396 private getServerArg ( ) : string [ ] {
387- return [
397+ let hlslSupported = vscode . workspace . getConfiguration ( "shader-validator" ) . get < boolean > ( "hlsl.enabled" ) ! ;
398+ let glslSupported = vscode . workspace . getConfiguration ( "shader-validator" ) . get < boolean > ( "glsl.enabled" ) ! ;
399+ let wgslSupported = vscode . workspace . getConfiguration ( "shader-validator" ) . get < boolean > ( "wgsl.enabled" ) ! ;
400+ let commonArgs = [
388401 "--config" ,
389402 getConfigurationAsString ( )
390403 ] ;
404+ if ( hlslSupported ) {
405+ commonArgs . push ( "--hlsl" ) ;
406+ }
407+ if ( glslSupported ) {
408+ commonArgs . push ( "--glsl" ) ;
409+ }
410+ if ( wgslSupported ) {
411+ commonArgs . push ( "--wgsl" ) ;
412+ }
413+ if ( ! hlslSupported && ! glslSupported && ! wgslSupported ) {
414+ vscode . window . showWarningMessage ( "No language enabled for shader-language-server. Server will still start." ) ;
415+ }
416+ return commonArgs ;
391417 }
392418 private getServerEnv ( ) {
393419 const trace = vscode . workspace . getConfiguration ( "shader-validator" ) . get < string > ( "trace.server" ) ;
0 commit comments