Trigger default settings change only after updating the model

This commit is contained in:
Sandeep Somavarapu
2017-11-15 12:00:07 +01:00
parent d5d1e76155
commit dd6dbe86b4
2 changed files with 2 additions and 5 deletions
@@ -123,6 +123,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
}
defaultSettings = this.getDefaultSettings(scope);
this.modelService.updateModel(model, defaultSettings.parse());
defaultSettings._onDidChange.fire();
}
});
@@ -511,7 +511,7 @@ export class DefaultSettings extends Disposable {
private _content: string;
private _settingsByName: Map<string, ISetting>;
private _onDidChange: Emitter<void> = this._register(new Emitter<void>());
readonly _onDidChange: Emitter<void> = this._register(new Emitter<void>());
readonly onDidChange: Event<void> = this._onDidChange.event;
constructor(
@@ -536,16 +536,12 @@ export class DefaultSettings extends Disposable {
}
parse(): string {
const currentContent = this._content;
const configurations = Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurations().slice();
const settingsGroups = this.removeEmptySettingsGroups(configurations.sort(this.compareConfigurationNodes).reduce((result, config, index, array) => this.parseConfig(config, result, array), []));
this.initAllSettingsMap(settingsGroups);
const mostCommonlyUsed = this.getMostCommonlyUsedSettings(settingsGroups);
this._allSettingsGroups = [mostCommonlyUsed, ...settingsGroups];
this._content = this.toContent(mostCommonlyUsed, settingsGroups);
if (this._content !== currentContent) {
this._onDidChange.fire();
}
return this._content;
}