mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
add enableProposedApi check
This commit is contained in:
parent
80718e85da
commit
bb9974812a
|
@ -3,10 +3,11 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IExtensionPoint } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IExtensionPoint, IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { ViewsWelcomeExtensionPoint, ViewWelcome, ViewIdentifierMap } from './viewsWelcomeExtensionPoint';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions as ViewContainerExtensions, IViewsRegistry } from 'vs/workbench/common/views';
|
||||
|
@ -34,7 +35,7 @@ export class ViewsWelcomeContribution extends Disposable implements IWorkbenchCo
|
|||
for (const contribution of added) {
|
||||
for (const welcome of contribution.value) {
|
||||
const id = ViewIdentifierMap[welcome.view] ?? welcome.view;
|
||||
const { group, order } = parseGroupAndOrder(welcome);
|
||||
const { group, order } = parseGroupAndOrder(welcome, contribution);
|
||||
const disposable = viewsRegistry.registerViewWelcomeContent(id, {
|
||||
content: welcome.contents,
|
||||
when: ContextKeyExpr.deserialize(welcome.when),
|
||||
|
@ -49,10 +50,16 @@ export class ViewsWelcomeContribution extends Disposable implements IWorkbenchCo
|
|||
}
|
||||
}
|
||||
|
||||
function parseGroupAndOrder(welcome: ViewWelcome): { group: string | undefined, order: number | undefined } {
|
||||
function parseGroupAndOrder(welcome: ViewWelcome, contribution: IExtensionPointUser<ViewsWelcomeExtensionPoint>): { group: string | undefined, order: number | undefined } {
|
||||
|
||||
let group: string | undefined;
|
||||
let order: number | undefined;
|
||||
if (welcome.group) {
|
||||
if (!contribution.description.enableProposedApi) {
|
||||
contribution.collector.warn(nls.localize('ViewsWelcomeExtensionPoint.proposedAPI', "The viewsWelcome contribution in '{0}' requires 'enableProposedApi' to be enabled.", contribution.description.identifier.value));
|
||||
return { group, order };
|
||||
}
|
||||
|
||||
const idx = welcome.group.lastIndexOf('@');
|
||||
if (idx > 0) {
|
||||
group = welcome.group.substr(0, idx);
|
||||
|
|
Loading…
Reference in a new issue