Skip to content

Commit defc889

Browse files
test
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent 3234130 commit defc889

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

code/src/vs/workbench/services/extensions/common/extensions.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,12 @@ export function isProposedApiEnabled(extension: IExtensionDescription, proposal:
324324
if (!extension.enabledApiProposals) {
325325
return false;
326326
}
327-
return extension.enabledApiProposals.includes(proposal);
327+
console.log('+++++++++ isProposedApiEnabled ', extension.displayName, proposal);
328+
return extension.enabledApiProposals.some(entry => {
329+
console.log('+++ isProposedApiEnabled ', entry);
330+
console.log('+++ ', entry === proposal || entry.startsWith(`${proposal}@`));
331+
return entry === proposal || entry.startsWith(`${proposal}@`);
332+
});
328333
}
329334

330335
export function checkProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): void {

code/src/vs/workbench/services/extensions/common/extensionsProposedApi.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,19 @@ export class ExtensionsProposedApi {
6767

6868
// warn about invalid proposal and remove them from the list
6969
if (isNonEmptyArray(extension.enabledApiProposals)) {
70-
extension.enabledApiProposals = extension.enabledApiProposals.filter(name => {
71-
const result = Boolean(allApiProposals[<ApiProposalName>name]);
70+
const normalizedProposals: ApiProposalName[] = [];
71+
for (const name of extension.enabledApiProposals) {
72+
const normalizedName = normalizeProposedApiName(name);
73+
const result = Boolean(allApiProposals[normalizedName]);
7274
if (!result) {
7375
this._logService.error(`Extension '${key}' wants API proposal '${name}' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.`);
76+
continue;
7477
}
75-
return result;
76-
});
78+
if (!normalizedProposals.includes(normalizedName)) {
79+
normalizedProposals.push(normalizedName);
80+
}
81+
}
82+
extension.enabledApiProposals = normalizedProposals;
7783
}
7884

7985

@@ -115,6 +121,11 @@ export class ExtensionsProposedApi {
115121
}
116122
}
117123

124+
function normalizeProposedApiName(name: string): ApiProposalName {
125+
const match = /^(.+?)@\d+$/.exec(name);
126+
return (match ? match[1] : name) as ApiProposalName;
127+
}
128+
118129
class ApiProposalsMarkdowneRenderer extends Disposable implements IExtensionFeatureMarkdownRenderer {
119130

120131
readonly type = 'markdown';

0 commit comments

Comments
 (0)