This commit is contained in:
Sandeep Somavarapu
2021-11-17 15:43:48 +01:00
parent bdc7b61a66
commit 35a8a61140

View File

@@ -7,6 +7,7 @@ import { coalesce } from 'vs/base/common/arrays';
import { forEach } from 'vs/base/common/collections';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as resources from 'vs/base/common/resources';
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@@ -310,12 +311,12 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
}
for (let descriptor of viewsContainersDescriptors) {
if (typeof descriptor.id !== 'string') {
collector.error(localize('requireidstring', "property `{0}` is mandatory and must be of type `string`. Only alphanumeric characters, '_', and '-' are allowed.", 'id'));
if (typeof descriptor.id !== 'string' && isFalsyOrWhitespace(descriptor.id)) {
collector.error(localize('requireidstring', "property `{0}` is mandatory and must be of type `string` with non-empty value. Only alphanumeric characters, '_', and '-' are allowed.", 'id'));
return false;
}
if (!(/^[a-z0-9_-]+$/i.test(descriptor.id))) {
collector.error(localize('requireidstring', "property `{0}` is mandatory and must be of type `string`. Only alphanumeric characters, '_', and '-' are allowed.", 'id'));
collector.error(localize('requireidstring', "property `{0}` is mandatory and must be of type `string` with non-empty value. Only alphanumeric characters, '_', and '-' are allowed.", 'id'));
return false;
}
if (typeof descriptor.title !== 'string') {
@@ -326,6 +327,10 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
collector.error(localize('requirestring', "property `{0}` is mandatory and must be of type `string`", 'icon'));
return false;
}
if (isFalsyOrWhitespace(descriptor.title)) {
collector.warn(localize('requirenonemptystring', "property `{0}` is mandatory and must be of type `string` with non-empty value", 'title'));
return true;
}
}
return true;
@@ -337,7 +342,8 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
const icon = themeIcon || resources.joinPath(extension.extensionLocation, descriptor.icon);
const id = `workbench.view.extension.${descriptor.id}`;
const viewContainer = this.registerCustomViewContainer(id, descriptor.title, icon, order++, extension.identifier, location);
const title = descriptor.title || id;
const viewContainer = this.registerCustomViewContainer(id, title, icon, order++, extension.identifier, location);
// Move those views that belongs to this container
if (existingViewContainers.length) {