Error handling for dashboard tab contributions (#851)

* support tab without title

* address comments

* formatting

* support error validation for dashboard tab and container contributions

* formatting
This commit is contained in:
Abbie Petchtes
2018-03-07 11:06:42 -08:00
committed by GitHub
parent ba188189a8
commit 7f79ab47ac
8 changed files with 214 additions and 46 deletions

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
@@ -18,3 +19,17 @@ let gridContainersSchema: IJSONSchema = {
registerContainerType(GRID_CONTAINER, gridContainersSchema);
registerNavSectionContainerType(GRID_CONTAINER, gridContainersSchema);
export function validateGridContainerContribution(extension: IExtensionPointUser<any>, gridConfigs: object[]): boolean {
let result = true;
gridConfigs.forEach(widgetConfig => {
let allKeys = Object.keys(widgetConfig);
let widgetOrWebviewKey = allKeys.find(key => key === 'widget' || key === 'webview');
if (!widgetOrWebviewKey) {
result = false;
extension.collector.error(nls.localize('gridContainer.invalidInputs', 'widgets or webviews are expected inside widgets-container for extension.'));
return;
}
});
return result;
}