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

editor: add confirmation prompt when executing clear editor history #12496

Closed
vince-fugnitto opened this issue May 8, 2023 · 2 comments · Fixed by #12506
Closed

editor: add confirmation prompt when executing clear editor history #12496

vince-fugnitto opened this issue May 8, 2023 · 2 comments · Fixed by #12506
Assignees
Labels
editor issues related to the editor good first issue good first issues for new contributors ui/ux issues related to user interface / user experience

Comments

@vince-fugnitto
Copy link
Member

Feature Description

The goal is to prompt end-users to confirm whether or not they want to actually clear their editor history (the history of recently opened editors). The confirmation will prevent clearing history accidentally for instance, and aligns with the behavior present in VS Code.

Related Code

Command Registration:

this.commandRegistry.registerHandler(EditorCommands.CLEAR_EDITOR_HISTORY.id, {
execute: () => this.locationStack.clearHistory(),
isEnabled: () => this.locationStack.locations().length > 0
});

ConfirmDialog:

Definition:

export class ConfirmDialog extends AbstractDialog<boolean> {

Example Usage:

export async function confirmExit(): Promise<boolean> {
const safeToExit = await new ConfirmDialog({
title: nls.localizeByDefault('Are you sure you want to quit?'),
msg: nls.localize('theia/core/quitMessage', 'Any unsaved changes will not be saved.'),
ok: Dialog.YES,
cancel: Dialog.NO,
}).open();
return safeToExit === true;
}

@vince-fugnitto vince-fugnitto added good first issue good first issues for new contributors editor issues related to the editor ui/ux issues related to user interface / user experience labels May 8, 2023
@souravghosh01
Copy link
Contributor

I want to work on this issue

@vince-fugnitto
Copy link
Member Author

I want to work on this issue

@souravghosh01 please go ahead :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor issues related to the editor good first issue good first issues for new contributors ui/ux issues related to user interface / user experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants