From cb3c8e7e50ed530f272973b5ddf67a95873ba901 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 19 Jan 2018 17:56:23 +0100 Subject: [PATCH] fix format on save problem that occurs when a provider returns no edits --- .../api/electron-browser/mainThreadSaveParticipant.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts b/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts index 5d0a02c34e3..07a61e0f3b8 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts @@ -26,6 +26,7 @@ import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerServ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IProgressService2, ProgressLocation } from 'vs/platform/progress/common/progress'; import { localize } from 'vs/nls'; +import { isFalsyOrEmpty } from 'vs/base/common/arrays'; export interface ISaveParticipantParticipant extends ISaveParticipant { // progressMessage: string; @@ -208,7 +209,7 @@ class FormatOnSaveParticipant implements ISaveParticipantParticipant { }); }).then(edits => { - if (edits && versionNow === model.getVersionId()) { + if (!isFalsyOrEmpty(edits) && versionNow === model.getVersionId()) { const editor = findEditor(model, this._editorService); if (editor) { this._editsWithEditor(editor, edits); -- GitLab