@@ -182,6 +182,16 @@ function darkenColor(color) {
182
182
return res ;
183
183
}
184
184
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
+
185
195
function getLanguageMappings ( ) {
186
196
let langMappings = { } ;
187
197
let allExtensions = fs . readdirSync ( '..' ) ;
@@ -204,7 +214,22 @@ function getLanguageMappings() {
204
214
if ( Array . isArray ( filenames ) ) {
205
215
mapping . fileNames = filenames . map ( function ( f ) { return f . toLowerCase ( ) ; } ) ;
206
216
}
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
+ }
208
233
}
209
234
}
210
235
}
@@ -216,6 +241,8 @@ function getLanguageMappings() {
216
241
return langMappings ;
217
242
}
218
243
244
+
245
+
219
246
exports . copyFont = function ( ) {
220
247
return downloadBinary ( font , './icons/seti.woff' ) ;
221
248
} ;
0 commit comments