Skip to content

Commit

Permalink
fixup! read preference schema from a plugin's manifest file
Browse files Browse the repository at this point in the history
  • Loading branch information
akurinnoy committed Oct 12, 2018
1 parent 2d1872b commit cd8ef2b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/browser/preferences/preference-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ export class PreferenceSchemaProvider extends PreferenceProvider {
) {
super();
this.preferenceContributions.getContributions().forEach(contrib => {
this.setSchema(contrib.schema);
this.setSchema(contrib.schema, false);
});
this.validateFunction = new Ajv().compile(this.combinedSchema);
this._ready.resolve();
}

Expand All @@ -84,7 +85,7 @@ export class PreferenceSchemaProvider extends PreferenceProvider {
return this.preferences;
}

setSchema(schema: PreferenceSchema): void {
setSchema(schema: PreferenceSchema, updateValidation: boolean = true): void {
const props: string[] = [];
for (const property in schema.properties) {
if (this.combinedSchema.properties[property]) {
Expand All @@ -94,7 +95,10 @@ export class PreferenceSchemaProvider extends PreferenceProvider {
props.push(property);
}
}
this.validateFunction = new Ajv().compile(this.combinedSchema);
if (updateValidation) {
this.validateFunction = new Ajv().compile(this.combinedSchema);
}

// tslint:disable-next-line:forin
for (const property of props) {
this.preferences[property] = this.combinedSchema.properties[property].default;
Expand Down

0 comments on commit cd8ef2b

Please sign in to comment.