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

fix #54431

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