@@ -23,8 +23,13 @@ interface ISchemaAssociations {
2323 [ pattern : string ] : string [ ] ;
2424}
2525
26+ interface ISchemaAssociation {
27+ fileMatch : string [ ] ;
28+ uri : string ;
29+ }
30+
2631namespace SchemaAssociationNotification {
27- export const type : NotificationType < ISchemaAssociations , any > = new NotificationType ( 'json/schemaAssociations' ) ;
32+ export const type : NotificationType < ISchemaAssociations | ISchemaAssociation [ ] , any > = new NotificationType ( 'json/schemaAssociations' ) ;
2833}
2934
3035namespace VSCodeContentRequest {
@@ -230,7 +235,7 @@ namespace LimitExceededWarnings {
230235}
231236
232237let jsonConfigurationSettings : JSONSchemaSettings [ ] | undefined = undefined ;
233- let schemaAssociations : ISchemaAssociations | undefined = undefined ;
238+ let schemaAssociations : ISchemaAssociations | ISchemaAssociation [ ] | undefined = undefined ;
234239let formatterRegistration : Thenable < Disposable > | null = null ;
235240
236241// The settings have changed. Is send on server activation as well.
@@ -291,12 +296,16 @@ function updateConfiguration() {
291296 schemas : new Array < SchemaConfiguration > ( )
292297 } ;
293298 if ( schemaAssociations ) {
294- for ( const pattern in schemaAssociations ) {
295- const association = schemaAssociations [ pattern ] ;
296- if ( Array . isArray ( association ) ) {
297- association . forEach ( uri => {
298- languageSettings . schemas . push ( { uri, fileMatch : [ pattern ] } ) ;
299- } ) ;
299+ if ( Array . isArray ( schemaAssociations ) ) {
300+ Array . prototype . push . apply ( languageSettings . schemas , schemaAssociations ) ;
301+ } else {
302+ for ( const pattern in schemaAssociations ) {
303+ const association = schemaAssociations [ pattern ] ;
304+ if ( Array . isArray ( association ) ) {
305+ association . forEach ( uri => {
306+ languageSettings . schemas . push ( { uri, fileMatch : [ pattern ] } ) ;
307+ } ) ;
308+ }
300309 }
301310 }
302311 }
0 commit comments