Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vscode] vscode.extension.contributes.configuration can be array #6078

Merged
merged 1 commit into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/common/plugin-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export namespace PluginPackage {
* This interface describes a package.json contribution section object.
*/
export interface PluginPackageContribution {
configuration?: RecursivePartial<PreferenceSchema>;
configuration?: RecursivePartial<PreferenceSchema> | RecursivePartial<PreferenceSchema>[];
configurationDefaults?: RecursivePartial<PreferenceSchemaProperties>;
languages?: PluginPackageLanguageContribution[];
grammars?: PluginPackageGrammarsContribution[];
Expand Down Expand Up @@ -388,7 +388,7 @@ export interface PluginModel {
* This interface describes some static plugin contributions.
*/
export interface PluginContribution {
configuration?: PreferenceSchema;
configuration?: PreferenceSchema | PreferenceSchema[];
configurationDefaults?: PreferenceSchemaProperties;
languages?: LanguageContribution[];
grammars?: GrammarsContribution[];
Expand Down
14 changes: 12 additions & 2 deletions packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,18 @@ export class TheiaPluginScanner implements PluginScanner {

const contributions: PluginContribution = {};
if (rawPlugin.contributes.configuration) {
const config = this.readConfiguration(rawPlugin.contributes.configuration, rawPlugin.packagePath);
contributions.configuration = config;
if (Array.isArray(rawPlugin.contributes.configuration)) {
contributions.configuration = [];
for (const c of rawPlugin.contributes.configuration) {
const config = this.readConfiguration(c, rawPlugin.packagePath);
if (config) {
contributions.configuration.push(config);
}
}
} else {
const config = this.readConfiguration(rawPlugin.contributes.configuration, rawPlugin.packagePath);
contributions.configuration = config;
}
}
const configurationDefaults = rawPlugin.contributes.configurationDefaults;
contributions.configurationDefaults = PreferenceSchemaProperties.is(configurationDefaults) ? configurationDefaults : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ export class PluginContributionHandler {

handleContributions(contributions: PluginContribution): void {
if (contributions.configuration) {
this.updateConfigurationSchema(contributions.configuration);
if (Array.isArray(contributions.configuration)) {
for (const config of contributions.configuration) {
this.updateConfigurationSchema(config);
}
} else {
this.updateConfigurationSchema(contributions.configuration);
}
}
if (contributions.configurationDefaults) {
this.updateDefaultOverridesSchema(contributions.configurationDefaults);
Expand Down