Skip to content

Add API to force quit with the ability to revert changes silently#21593

Merged
bpasero merged 4 commits intomicrosoft:masterfrom
misoguy:force-quit
Mar 1, 2017
Merged

Add API to force quit with the ability to revert changes silently#21593
bpasero merged 4 commits intomicrosoft:masterfrom
misoguy:force-quit

Conversation

@misoguy
Copy link
Contributor

@misoguy misoguy commented Mar 1, 2017

Fix #21536
Adds "workbench.action.forceCloseActiveEditor" to externalAPI

@mention-bot
Copy link

@misoguy, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bpasero and @egamma to be potential reviewers.

@msftclas
Copy link

msftclas commented Mar 1, 2017

@misoguy,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by Microsoft. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks much better, added some minor feedback.


export class ForceCloseEditorAction extends Action {

public static ID = 'workbench.action.forceCloseActiveEditor';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better workbench.action.revertAndCloseActiveEditor ?

}
}

export class ForceCloseEditorAction extends Action {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to move this into editorActions.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a commit to move this into vs/workbench/browser/parts/editor/editorActions.ts.

I have previously added it into vs/workbench/electron-browser/actions.ts
because i found the command "workbench.action.closeActiveEditor" to be at 2 files (actions.ts & editorActions.ts) and it seemed like main.contribution.ts was importing the CloseEditorAction from the one in vs/workbench/electron-browser/actions.ts.

It'd be nice if you could briefly explain the difference between the two files(actions.ts & editorActions.ts) with the same command "workbench.action.closeActiveEditor"

export class ForceCloseEditorAction extends Action {

public static ID = 'workbench.action.forceCloseActiveEditor';
public static LABEL = nls.localize('forceCloseActiveEditor', "Force Close Editor");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert and Close Editor

@bpasero bpasero self-assigned this Mar 1, 2017
@bpasero bpasero merged commit 8020067 into microsoft:master Mar 1, 2017
@bpasero
Copy link
Member

bpasero commented Mar 1, 2017

Thanks 👍

@bpasero bpasero added this to the March 2017 milestone Mar 1, 2017
@misoguy misoguy deleted the force-quit branch March 1, 2017 12:28
@samusstrike
Copy link

samusstrike commented Feb 27, 2020

Did this API ever get added (workbench.action.forceCloseActiveEditor, or with another action name)? I do not see this documented. I've been looking for a way to close the active editor and not prompt the user to save.

I thought about creating another feature request issue to ask for the ability to save the activeEditor as a URI provided by an extension. For example: workbench.action.saveActiveEditorAsURI, in which the URI is provided as an argument. The key here is I do not want the user to provide the file location. Does this request exist or shall I create one?

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Force quit with the ability to revert changes silently

5 participants