@@ -151,16 +151,24 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
151
151
this . _register ( disposableTimeout ( ( ) => this . promptRecommendations ( uri , model ) , 0 ) ) ;
152
152
}
153
153
154
+ private promptRecommendations ( uri : URI , model : ITextModel ) : void {
155
+ if ( this . promptImportantRecommendations ( uri , model ) ) {
156
+ return ;
157
+ }
158
+
159
+ this . promptRecommendedExtensionForFileExtension ( uri , extname ( uri ) . toLowerCase ( ) ) ;
160
+ }
161
+
154
162
/**
155
163
* Prompt the user to either install the recommended extension for the file type in the current editor model
156
164
* or prompt to search the marketplace if it has extensions that can support the file type
157
165
*/
158
- private promptRecommendations ( uri : URI , model : ITextModel , extensionRecommendations ?: IStringDictionary < IFileOpenCondition [ ] > ) : void {
166
+ private promptImportantRecommendations ( uri : URI , model : ITextModel , extensionRecommendations ?: IStringDictionary < IFileOpenCondition [ ] > ) : boolean {
159
167
const pattern = extname ( uri ) . toLowerCase ( ) ;
160
168
extensionRecommendations = extensionRecommendations ?? this . recommendationsByPattern . get ( pattern ) ?? this . fileOpenRecommendations ;
161
169
const extensionRecommendationEntries = Object . entries ( extensionRecommendations ) ;
162
170
if ( extensionRecommendationEntries . length === 0 ) {
163
- return ;
171
+ return false ;
164
172
}
165
173
166
174
const processedPathGlobs = new Map < string , boolean > ( ) ;
@@ -246,10 +254,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
246
254
}
247
255
}
248
256
249
- if ( Object . keys ( matchedRecommendations ) . length ) {
250
- this . promptFromRecommendations ( uri , model , matchedRecommendations ) ;
251
- }
252
-
253
257
this . recommendationsByPattern . set ( pattern , recommendationsByPattern ) ;
254
258
if ( Object . keys ( unmatchedRecommendations ) . length ) {
255
259
if ( listenOnLanguageChange ) {
@@ -258,14 +262,21 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
258
262
// re-schedule this bit of the operation to be off the critical path - in case glob-match is slow
259
263
disposables . add ( disposableTimeout ( ( ) => {
260
264
if ( ! disposables . isDisposed ) {
261
- this . promptRecommendations ( uri , model , unmatchedRecommendations ) ;
265
+ this . promptImportantRecommendations ( uri , model , unmatchedRecommendations ) ;
262
266
disposables . dispose ( ) ;
263
267
}
264
268
} , 0 ) ) ;
265
269
} ) ) ;
266
270
disposables . add ( model . onWillDispose ( ( ) => disposables . dispose ( ) ) ) ;
267
271
}
268
272
}
273
+
274
+ if ( Object . keys ( matchedRecommendations ) . length ) {
275
+ this . promptFromRecommendations ( uri , model , matchedRecommendations ) ;
276
+ return true ;
277
+ }
278
+
279
+ return false ;
269
280
}
270
281
271
282
private promptFromRecommendations ( uri : URI , model : ITextModel , extensionRecommendations : IStringDictionary < IFileOpenCondition [ ] > ) : void {
@@ -304,8 +315,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
304
315
this . promptRecommendedExtensionForFileType ( languageName && isImportantRecommendationForLanguage && language !== PLAINTEXT_LANGUAGE_ID ? localize ( 'languageName' , "{0} language" , languageName ) : basename ( uri ) , language , [ ...importantRecommendations ] ) ) {
305
316
return ;
306
317
}
307
-
308
- this . promptRecommendedExtensionForFileExtension ( uri , extname ( uri ) . toLowerCase ( ) ) ;
309
318
}
310
319
311
320
private promptRecommendedExtensionForFileType ( name : string , language : string , recommendations : string [ ] ) : boolean {
0 commit comments