@@ -182,6 +182,16 @@ function darkenColor(color) {
182182 return res ;
183183}
184184
185+ function mergeMapping ( to , from , property ) {
186+ if ( from [ property ] ) {
187+ if ( to [ property ] ) {
188+ to [ property ] . push ( ...from [ property ] ) ;
189+ } else {
190+ to [ property ] = from [ property ] ;
191+ }
192+ }
193+ }
194+
185195function getLanguageMappings ( ) {
186196 let langMappings = { } ;
187197 let allExtensions = fs . readdirSync ( '..' ) ;
@@ -204,7 +214,22 @@ function getLanguageMappings() {
204214 if ( Array . isArray ( filenames ) ) {
205215 mapping . fileNames = filenames . map ( function ( f ) { return f . toLowerCase ( ) ; } ) ;
206216 }
207- langMappings [ languageId ] = mapping ;
217+ let existing = langMappings [ languageId ] ;
218+
219+ if ( existing ) {
220+ // multiple contributions to the same language
221+ // give preference to the contribution wth the configuration
222+ if ( languages [ k ] . configuration ) {
223+ mergeMapping ( mapping , existing , 'extensions' ) ;
224+ mergeMapping ( mapping , existing , 'fileNames' ) ;
225+ langMappings [ languageId ] = mapping ;
226+ } else {
227+ mergeMapping ( existing , mapping , 'extensions' ) ;
228+ mergeMapping ( existing , mapping , 'fileNames' ) ;
229+ }
230+ } else {
231+ langMappings [ languageId ] = mapping ;
232+ }
208233 }
209234 }
210235 }
@@ -216,6 +241,8 @@ function getLanguageMappings() {
216241 return langMappings ;
217242}
218243
244+
245+
219246exports . copyFont = function ( ) {
220247 return downloadBinary ( font , './icons/seti.woff' ) ;
221248} ;
0 commit comments