提交 ed5da7ac 编写于 作者: J Johannes Rieken

fix #54431

上级 fdd5cf49
...@@ -215,16 +215,20 @@ class FormatOnSaveParticipant implements ISaveParticipantParticipant { ...@@ -215,16 +215,20 @@ class FormatOnSaveParticipant implements ISaveParticipantParticipant {
const timeout = this._configurationService.getValue('editor.formatOnSaveTimeout', { overrideIdentifier: model.getLanguageIdentifier().language, resource: editorModel.getResource() }); const timeout = this._configurationService.getValue('editor.formatOnSaveTimeout', { overrideIdentifier: model.getLanguageIdentifier().language, resource: editorModel.getResource() });
return new Promise<ISingleEditOperation[]>((resolve, reject) => { return new Promise<ISingleEditOperation[]>((resolve, reject) => {
setTimeout(() => reject(localize('timeout.formatOnSave', "Aborted format on save after {0}ms", timeout)), timeout); let request = getDocumentFormattingEdits(model, { tabSize, insertSpaces });
getDocumentFormattingEdits(model, { tabSize, insertSpaces })
.then(edits => this._editorWorkerService.computeMoreMinimalEdits(model.uri, edits)) setTimeout(() => {
.then(resolve, err => { reject(localize('timeout.formatOnSave', "Aborted format on save after {0}ms", timeout));
if (!(err instanceof Error) || err.name !== NoProviderError.Name) { request.cancel();
reject(err); }, timeout);
} else {
resolve(); request.then(edits => this._editorWorkerService.computeMoreMinimalEdits(model.uri, edits)).then(resolve, err => {
} if (!(err instanceof Error) || err.name !== NoProviderError.Name) {
}); reject(err);
} else {
resolve();
}
});
}).then(edits => { }).then(edits => {
if (!isFalsyOrEmpty(edits) && versionNow === model.getVersionId()) { if (!isFalsyOrEmpty(edits) && versionNow === model.getVersionId()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册