Skip to content

Commit bb99748

Browse files
committed
add enableProposedApi check
1 parent 80718e8 commit bb99748

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/vs/workbench/contrib/welcome/common/viewsWelcomeContribution.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import * as nls from 'vs/nls';
67
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
78
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
89
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
9-
import { IExtensionPoint } from 'vs/workbench/services/extensions/common/extensionsRegistry';
10+
import { IExtensionPoint, IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
1011
import { ViewsWelcomeExtensionPoint, ViewWelcome, ViewIdentifierMap } from './viewsWelcomeExtensionPoint';
1112
import { Registry } from 'vs/platform/registry/common/platform';
1213
import { Extensions as ViewContainerExtensions, IViewsRegistry } from 'vs/workbench/common/views';
@@ -34,7 +35,7 @@ export class ViewsWelcomeContribution extends Disposable implements IWorkbenchCo
3435
for (const contribution of added) {
3536
for (const welcome of contribution.value) {
3637
const id = ViewIdentifierMap[welcome.view] ?? welcome.view;
37-
const { group, order } = parseGroupAndOrder(welcome);
38+
const { group, order } = parseGroupAndOrder(welcome, contribution);
3839
const disposable = viewsRegistry.registerViewWelcomeContent(id, {
3940
content: welcome.contents,
4041
when: ContextKeyExpr.deserialize(welcome.when),
@@ -49,10 +50,16 @@ export class ViewsWelcomeContribution extends Disposable implements IWorkbenchCo
4950
}
5051
}
5152

52-
function parseGroupAndOrder(welcome: ViewWelcome): { group: string | undefined, order: number | undefined } {
53+
function parseGroupAndOrder(welcome: ViewWelcome, contribution: IExtensionPointUser<ViewsWelcomeExtensionPoint>): { group: string | undefined, order: number | undefined } {
54+
5355
let group: string | undefined;
5456
let order: number | undefined;
5557
if (welcome.group) {
58+
if (!contribution.description.enableProposedApi) {
59+
contribution.collector.warn(nls.localize('ViewsWelcomeExtensionPoint.proposedAPI', "The viewsWelcome contribution in '{0}' requires 'enableProposedApi' to be enabled.", contribution.description.identifier.value));
60+
return { group, order };
61+
}
62+
5663
const idx = welcome.group.lastIndexOf('@');
5764
if (idx > 0) {
5865
group = welcome.group.substr(0, idx);

0 commit comments

Comments
 (0)