未验证 提交 4da8e504 编写于 作者: M Matt Bierner 提交者: GitHub

Don't show users a notification if a save is cancelled (#110344)

Problem:
- For a custom editor with a long running save operation
- The user makes an edit and then saves
- While the first save is still happening, the user saves the file again

When the second save happens, we try to cancel the first save. However this currently results in a `cancelled` notification being shown to the user.

The fix is to not show the nofication for cancelled since it is an expected error

Fixes #107190
上级 17c29f0b
......@@ -44,6 +44,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
import { openEditorWith } from 'vs/workbench/services/editor/common/editorOpenWith';
import { isPromiseCanceledError } from 'vs/base/common/errors';
// Commands
......@@ -444,7 +445,9 @@ async function doSaveEditors(accessor: ServicesAccessor, editors: IEditorIdentif
try {
await editorService.save(editors, options);
} catch (error) {
notificationService.error(nls.localize({ key: 'genericSaveError', comment: ['{0} is the resource that failed to save and {1} the error message'] }, "Failed to save '{0}': {1}", editors.map(({ editor }) => editor.getName()).join(', '), toErrorMessage(error, false)));
if (!isPromiseCanceledError(error)) {
notificationService.error(nls.localize({ key: 'genericSaveError', comment: ['{0} is the resource that failed to save and {1} the error message'] }, "Failed to save '{0}': {1}", editors.map(({ editor }) => editor.getName()).join(', '), toErrorMessage(error, false)));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册