@@ -149,6 +149,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
149
149
const matchedRecommendations : IStringDictionary < IFileOpenCondition [ ] > = { } ;
150
150
const unmatchedRecommendations : IStringDictionary < IFileOpenCondition [ ] > = { } ;
151
151
let listenOnLanguageChange = false ;
152
+ const languageId = model . getLanguageId ( ) ;
152
153
153
154
for ( const [ extensionId , conditions ] of extensionRecommendationEntries ) {
154
155
const conditionsByPattern : IFileOpenCondition [ ] = [ ] ;
@@ -165,7 +166,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
165
166
}
166
167
167
168
if ( isLanguageCondition ) {
168
- if ( ( < IFileLanguageCondition > condition ) . languages . includes ( model . getLanguageId ( ) ) ) {
169
+ if ( ( < IFileLanguageCondition > condition ) . languages . includes ( languageId ) ) {
169
170
languageMatched = true ;
170
171
}
171
172
}
@@ -178,12 +179,13 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
178
179
processedPathGlobs . set ( pathGlob , pathGlobMatched ) ;
179
180
}
180
181
181
- if ( ! languageMatched && ! pathGlobMatched ) {
182
- // If the language is not matched and the path glob is not matched, then we don't need to check the other conditions
182
+ let matched = languageMatched || pathGlobMatched ;
183
+
184
+ // If the resource has pattern (extension) and not matched, then we don't need to check the other conditions
185
+ if ( pattern && ! matched ) {
183
186
continue ;
184
187
}
185
188
186
- let matched = true ;
187
189
if ( matched && condition . whenInstalled ) {
188
190
if ( ! condition . whenInstalled . every ( id => installed . some ( local => areSameExtensions ( { id } , local . identifier ) ) ) ) {
189
191
matched = false ;
@@ -226,7 +228,9 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
226
228
}
227
229
}
228
230
229
- this . recommendationsByPattern . set ( pattern , recommendationsByPattern ) ;
231
+ if ( pattern ) {
232
+ this . recommendationsByPattern . set ( pattern , recommendationsByPattern ) ;
233
+ }
230
234
if ( Object . keys ( unmatchedRecommendations ) . length ) {
231
235
if ( listenOnLanguageChange ) {
232
236
const disposables = new DisposableStore ( ) ;
0 commit comments