@@ -545,27 +545,32 @@ function getSettings(): Settings {
545
545
}
546
546
} ;
547
547
548
- const collectSchemaSettings = ( schemaSettings : JSONSchemaSettings [ ] , folderUri ?: Uri ) => {
549
- for ( const setting of schemaSettings ) {
550
- const url = getSchemaId ( setting , folderUri ) ;
551
- if ( url ) {
552
- const schemaSetting : JSONSchemaSettings = { url, fileMatch : setting . fileMatch , folderUri : folderUri ?. toString ( false ) , schema : setting . schema } ;
553
- schemas . push ( schemaSetting ) ;
548
+ const collectSchemaSettings = ( schemaSettings : JSONSchemaSettings [ ] | undefined , folderUri ?: Uri ) => {
549
+
550
+ if ( schemaSettings ) {
551
+ for ( const setting of schemaSettings ) {
552
+ const url = getSchemaId ( setting , folderUri ) ;
553
+ if ( url ) {
554
+ const schemaSetting : JSONSchemaSettings = { url, fileMatch : setting . fileMatch , folderUri : folderUri ?. toString ( false ) , schema : setting . schema } ;
555
+ schemas . push ( schemaSetting ) ;
556
+ }
554
557
}
555
558
}
556
559
} ;
557
560
558
- const globalSettings = workspace . getConfiguration ( 'json' , null ) . get < JSONSchemaSettings [ ] > ( 'schemas' ) ;
559
- if ( Array . isArray ( globalSettings ) ) {
560
- collectSchemaSettings ( globalSettings ) ;
561
+ const schemaConfigInfo = workspace . getConfiguration ( 'json' , null ) . inspect < JSONSchemaSettings [ ] > ( 'schemas' ) ;
562
+ if ( schemaConfigInfo ) {
563
+ if ( workspace . workspaceFile ) {
564
+ collectSchemaSettings ( schemaConfigInfo . workspaceValue , workspace . workspaceFile ) ;
565
+ }
566
+ collectSchemaSettings ( schemaConfigInfo . globalValue ) ;
561
567
}
568
+
562
569
const folders = workspace . workspaceFolders ;
563
570
if ( folders ) {
564
571
for ( const folder of folders ) {
565
572
const schemaConfigInfo = workspace . getConfiguration ( 'json' , folder . uri ) . inspect < JSONSchemaSettings [ ] > ( 'schemas' ) ;
566
- if ( schemaConfigInfo && Array . isArray ( schemaConfigInfo . workspaceFolderValue ) ) {
567
- collectSchemaSettings ( schemaConfigInfo . workspaceFolderValue , folder . uri ) ;
568
- }
573
+ collectSchemaSettings ( schemaConfigInfo ?. workspaceFolderValue , folder . uri ) ;
569
574
}
570
575
}
571
576
return settings ;
0 commit comments