From 5f8b697437f5a26c5bbd6c05d554920d4f978755 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 21 Mar 2018 10:38:34 +0100 Subject: [PATCH] better timeout-error messages for format on save and onWillSave-event, #45421 --- .../api/electron-browser/mainThreadSaveParticipant.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts b/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts index 61fdebb359e..33b9c3e3239 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts @@ -201,7 +201,7 @@ class FormatOnSaveParticipant implements ISaveParticipantParticipant { const timeout = this._configurationService.getValue('editor.formatOnSaveTimeout', { overrideIdentifier: model.getLanguageIdentifier().language, resource: editorModel.getResource() }); return new Promise((resolve, reject) => { - setTimeout(reject, timeout); + setTimeout(() => reject(localize('timeout.formatOnSave', "Aborted format on save after {0}ms", timeout)), timeout); getDocumentFormattingEdits(model, { tabSize, insertSpaces }) .then(edits => this._editorWorkerService.computeMoreMinimalEdits(model.uri, edits)) .then(resolve, err => { @@ -269,7 +269,7 @@ class ExtHostSaveParticipant implements ISaveParticipantParticipant { } return new Promise((resolve, reject) => { - setTimeout(reject, 1750); + setTimeout(() => reject(localize('timeout.onWillSave', "Aborted onWillSaveTextDocument-event after 1750ms")), 1750); this._proxy.$participateInSave(editorModel.getResource(), env.reason).then(values => { for (const success of values) { if (!success) { @@ -315,7 +315,7 @@ export class SaveParticipant implements ISaveParticipant { const promiseFactory = this._saveParticipants.map(p => () => { return Promise.resolve(p.participate(model, env)); }); - return sequence(promiseFactory).then(() => { }, err => this._logService.error(err)); + return sequence(promiseFactory).then(() => { }, err => this._logService.warn(err)); }); } } -- GitLab