From e0b006236e0e5b7f927b6b1342edbf6118b3a828 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 29 Jan 2020 12:05:41 +0100 Subject: [PATCH] misleading wording of "files.preventSaveConflicts" setting (fix #89510) --- src/vs/platform/files/common/files.ts | 2 +- .../browser/editors/textFileSaveErrorHandler.ts | 2 +- .../contrib/files/browser/files.contribution.ts | 16 ++++++++++++---- .../common/filesConfigurationService.ts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index 86252c89389..6360e6830a5 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -804,7 +804,7 @@ export interface IFilesConfiguration { eol: string; enableTrash: boolean; hotExit: string; - preventSaveConflicts: boolean; + saveConflictResolution: 'askUser' | 'overwriteFileOnDisk'; }; } diff --git a/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts b/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts index 1347bd30a29..5c214b0641d 100644 --- a/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts +++ b/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts @@ -332,7 +332,7 @@ class ConfigureSaveConflictAction extends Action { } run(): Promise { - this.preferencesService.openSettings(undefined, 'files.preventSaveConflicts'); + this.preferencesService.openSettings(undefined, 'files.saveConflictResolution'); return Promise.resolve(true); } diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts index f2f944b9836..691c176d94a 100644 --- a/src/vs/workbench/contrib/files/browser/files.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts @@ -322,10 +322,18 @@ configurationRegistry.registerConfiguration({ 'markdownDescription': nls.localize('maxMemoryForLargeFilesMB', "Controls the memory available to VS Code after restart when trying to open large files. Same effect as specifying `--max-memory=NEWSIZE` on the command line."), included: platform.isNative }, - 'files.preventSaveConflicts': { - 'type': 'boolean', - 'description': nls.localize('files.preventSaveConflicts', "When enabled, will prevent to save a file that has been changed since it was last edited. Instead, a diff editor is provided to compare the changes and accept or revert them. This setting should only be disabled if you frequently encounter save conflict errors and may result in data loss if used without caution."), - 'default': true, + 'files.saveConflictResolution': { + 'type': 'string', + 'enum': [ + 'askUser', + 'overwriteFileOnDisk' + ], + 'enumDescriptions': [ + nls.localize('askUser', "Will refuse to save and ask for resolving the save conflict manually."), + nls.localize('overwriteFileOnDisk', "Will resolve the save conflict by overwriting the file on disk with the changes in the editor.") + ], + 'description': nls.localize('files.saveConflictResolution', "A save conflict can occur when a file is saved to disk that was changed by another program in the meantime. To prevent data loss, the user is asked to compare the changes in the editor with the version on disk. This setting should only be changed if you frequently encounter save conflict errors and may result in data loss if used without caution."), + 'default': 'askUser', 'scope': ConfigurationScope.LANGUAGE_OVERRIDABLE }, 'files.simpleDialog.enable': { diff --git a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts index 0df4d59fa9b..7a9048cba8d 100644 --- a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts +++ b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts @@ -211,7 +211,7 @@ export class FilesConfigurationService extends Disposable implements IFilesConfi } preventSaveConflicts(resource: URI, language: string): boolean { - return this.configurationService.getValue('files.preventSaveConflicts', { resource, overrideIdentifier: language }); + return this.configurationService.getValue('files.saveConflictResolution', { resource, overrideIdentifier: language }) !== 'overwriteFileOnDisk'; } } -- GitLab