Notify no need to save on save

This commit is contained in:
Jackson Kearl 2018-08-24 10:02:35 -07:00
parent cb366e2871
commit fc739fedbd
2 changed files with 12 additions and 2 deletions

View file

@ -42,6 +42,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { ILabelService } from 'vs/platform/label/common/label';
import { SettingsEditor2 } from 'vs/workbench/parts/preferences/browser/settingsEditor2';
// Commands
@ -161,6 +162,11 @@ function save(
// Just save
return textFileService.save(resource, { force: true /* force a change to the file to trigger external watchers if any */ });
} else if (resource && resource.scheme === Schemas.vscode) {
const activeControl = editorService.activeControl;
if (activeControl instanceof SettingsEditor2) {
activeControl.notifyNoSaveNeeded();
}
}
return TPromise.as(false);

View file

@ -488,11 +488,15 @@ export class SettingsEditor2 extends BaseEditor {
}));
}
private onDidChangeSetting(key: string, value: any): void {
if (!this.storageService.getBoolean('hasNotifiedOfSettingsAutosave', StorageScope.GLOBAL, false)) {
public notifyNoSaveNeeded(force: boolean = true) {
if (force || !this.storageService.getBoolean('hasNotifiedOfSettingsAutosave', StorageScope.GLOBAL, false)) {
this.storageService.store('hasNotifiedOfSettingsAutosave', true, StorageScope.GLOBAL);
this.notificationService.info(localize('settingsNoSaveNeeded', "Your changes are automatically saved as you edit."));
}
}
private onDidChangeSetting(key: string, value: any): void {
this.notifyNoSaveNeeded(false);
if (this.pendingSettingUpdate && this.pendingSettingUpdate.key !== key) {
this.updateChangedSetting(key, value);