Skip to content

Commit a7ad1bf

Browse files
authored
1 parent 5a8659a commit a7ad1bf

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
149149
const matchedRecommendations: IStringDictionary<IFileOpenCondition[]> = {};
150150
const unmatchedRecommendations: IStringDictionary<IFileOpenCondition[]> = {};
151151
let listenOnLanguageChange = false;
152+
const languageId = model.getLanguageId();
152153

153154
for (const [extensionId, conditions] of extensionRecommendationEntries) {
154155
const conditionsByPattern: IFileOpenCondition[] = [];
@@ -165,7 +166,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
165166
}
166167

167168
if (isLanguageCondition) {
168-
if ((<IFileLanguageCondition>condition).languages.includes(model.getLanguageId())) {
169+
if ((<IFileLanguageCondition>condition).languages.includes(languageId)) {
169170
languageMatched = true;
170171
}
171172
}
@@ -178,12 +179,13 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
178179
processedPathGlobs.set(pathGlob, pathGlobMatched);
179180
}
180181

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) {
183186
continue;
184187
}
185188

186-
let matched = true;
187189
if (matched && condition.whenInstalled) {
188190
if (!condition.whenInstalled.every(id => installed.some(local => areSameExtensions({ id }, local.identifier)))) {
189191
matched = false;
@@ -226,7 +228,9 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
226228
}
227229
}
228230

229-
this.recommendationsByPattern.set(pattern, recommendationsByPattern);
231+
if (pattern) {
232+
this.recommendationsByPattern.set(pattern, recommendationsByPattern);
233+
}
230234
if (Object.keys(unmatchedRecommendations).length) {
231235
if (listenOnLanguageChange) {
232236
const disposables = new DisposableStore();

0 commit comments

Comments
 (0)