Merge pull request #43702 from buyology/formatOnSave-timeout

make the timeout for formatOnSave configurable
This commit is contained in:
Johannes Rieken
2018-03-02 15:59:12 +01:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -197,8 +197,10 @@ class FormatOnSaveParticipant implements ISaveParticipantParticipant {
const versionNow = model.getVersionId();
const { tabSize, insertSpaces } = model.getOptions();
const timeout = this._configurationService.getValue('editor.formatOnSaveTimeout', { overrideIdentifier: model.getLanguageIdentifier().language, resource: editorModel.getResource() });
return new Promise<ISingleEditOperation[]>((resolve, reject) => {
setTimeout(reject, 750);
setTimeout(reject, timeout);
getDocumentFormattingEdits(model, { tabSize, insertSpaces })
.then(edits => this._editorWorkerService.computeMoreMinimalEdits(model.uri, edits))
.then(resolve, err => {