Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: file-saving dialog with dirty editors #12864

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/api-tests/src/saveable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ describe('Saveable', function () {
shouldSave: () => true
});
assert.isTrue(outOfSync, 'file should be out of sync');
assert.isTrue(widget.isDisposed, 'model should be disposed after close');
assert.isFalse(widget.isDisposed, 'model should not be disposed after close when we reject the save');
const state = await fileService.read(fileUri);
assert.equal(state.value, 'foo2', 'fs should NOT be updated');
});
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/browser/saveable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ export namespace Saveable {
if (typeof result === 'boolean') {
if (result) {
await (doSave?.(this) ?? Saveable.save(this));
if (!isDirty(this)) {
await this.closeWithoutSaving();
}
} else {
await this.closeWithoutSaving();
}
await this.closeWithoutSaving();
}
} finally {
closing = false;
Expand Down
Loading