mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Add command to close all diff editors
This commit is contained in:
parent
6e99129744
commit
ce46f445c0
|
@ -531,6 +531,11 @@
|
|||
"title": "%command.rebaseAbort%",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.closeAllDiffEditors",
|
||||
"title": "%command.closeAllDiffEditors%",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.api.getRepositories",
|
||||
"title": "%command.api.getRepositories%",
|
||||
|
@ -933,6 +938,10 @@
|
|||
"command": "git.timeline.compareWithSelected",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "git.closeAllDiffEditors",
|
||||
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
|
||||
},
|
||||
{
|
||||
"command": "git.api.getRepositories",
|
||||
"when": "false"
|
||||
|
@ -2231,7 +2240,9 @@
|
|||
"default",
|
||||
"download"
|
||||
],
|
||||
"tags": ["experimental"],
|
||||
"tags": [
|
||||
"experimental"
|
||||
],
|
||||
"scope": "machine",
|
||||
"description": "%config.experimental.installGuide%",
|
||||
"default": "default"
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
"command.cleanAll": "Discard All Changes",
|
||||
"command.cleanAllTracked": "Discard All Tracked Changes",
|
||||
"command.cleanAllUntracked": "Discard All Untracked Changes",
|
||||
"command.closeAllDiffEditors": "Close All Diff Editors",
|
||||
"command.commit": "Commit",
|
||||
"command.commitStaged": "Commit Staged",
|
||||
"command.commitEmpty": "Commit Empty",
|
||||
|
|
|
@ -2753,6 +2753,17 @@ export class CommandCenter {
|
|||
}
|
||||
}
|
||||
|
||||
@command('git.closeAllDiffEditors', { repository: true })
|
||||
closeDiffEditors(repository: Repository): void {
|
||||
const resources = [
|
||||
...repository.indexGroup.resourceStates.map(r => r.resourceUri.fsPath),
|
||||
...repository.workingTreeGroup.resourceStates.map(r => r.resourceUri.fsPath),
|
||||
...repository.untrackedGroup.resourceStates.map(r => r.resourceUri.fsPath)
|
||||
];
|
||||
|
||||
repository.closeDiffEditors(resources, resources, true);
|
||||
}
|
||||
|
||||
private createCommand(id: string, key: string, method: Function, options: ScmCommandOptions): (...args: any[]) => any {
|
||||
const result = (...args: any[]) => {
|
||||
let result: Promise<any>;
|
||||
|
|
|
@ -1266,9 +1266,9 @@ export class Repository implements Disposable {
|
|||
});
|
||||
}
|
||||
|
||||
private closeDiffEditors(indexResources: string[], workingTreeResources: string[]): void {
|
||||
closeDiffEditors(indexResources: string[], workingTreeResources: string[], ignoreSetting: boolean = false): void {
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
if (!config.get<boolean>('closeDiffOnOperation', false)) { return; }
|
||||
if (!config.get<boolean>('closeDiffOnOperation', false) && !ignoreSetting) { return; }
|
||||
|
||||
const diffEditorTabsToClose: Tab[] = [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue