From d0e7a524980f33f5170aac97f74a98be35c6ed2d Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 22 Sep 2016 15:25:08 +0200 Subject: [PATCH] add setting --- src/vs/workbench/api/node/mainThreadSaveParticipant.ts | 2 +- src/vs/workbench/parts/files/browser/files.contribution.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/mainThreadSaveParticipant.ts b/src/vs/workbench/api/node/mainThreadSaveParticipant.ts index ca56d6ac3c8..f198d2e771f 100644 --- a/src/vs/workbench/api/node/mainThreadSaveParticipant.ts +++ b/src/vs/workbench/api/node/mainThreadSaveParticipant.ts @@ -82,7 +82,7 @@ class FormatOnSaveParticipant implements ISaveParticipant { } participate(editorModel: ITextFileEditorModel, env: { isAutoSaved: boolean }): TPromise { - if (true || this._configurationService.lookup('files.formatOnSave').value) { + if (this._configurationService.lookup('files.formatOnSave').value) { const model: IModel = editorModel.textEditorModel; const editor = this._findEditor(model); return formatDocument(model, editor); diff --git a/src/vs/workbench/parts/files/browser/files.contribution.ts b/src/vs/workbench/parts/files/browser/files.contribution.ts index 4029f5240e6..d9a1355dafe 100644 --- a/src/vs/workbench/parts/files/browser/files.contribution.ts +++ b/src/vs/workbench/parts/files/browser/files.contribution.ts @@ -212,6 +212,11 @@ configurationRegistry.registerConfiguration({ 'default': false, 'description': nls.localize('trimTrailingWhitespace', "When enabled, will trim trailing whitespace when you save a file.") }, + 'files.formatOnSave': { + 'type': 'boolean', + 'default': false, + 'description': nls.localize('formatOnSave', "Format a file on save - a matching formatting provider must be available.") + }, 'files.autoSave': { 'type': 'string', 'enum': [AutoSaveConfiguration.OFF, AutoSaveConfiguration.AFTER_DELAY, AutoSaveConfiguration.ON_FOCUS_CHANGE, , AutoSaveConfiguration.ON_WINDOW_CHANGE], -- GitLab