mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
@@ -2970,13 +2970,7 @@ 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);
|
||||
repository.closeDiffEditors(undefined, undefined, true);
|
||||
}
|
||||
|
||||
private createCommand(id: string, key: string, method: Function, options: ScmCommandOptions): (...args: any[]) => any {
|
||||
|
||||
@@ -1289,7 +1289,7 @@ export class Repository implements Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
closeDiffEditors(indexResources: string[], workingTreeResources: string[], ignoreSetting: boolean = false): void {
|
||||
closeDiffEditors(indexResources: string[] | undefined, workingTreeResources: string[] | undefined, ignoreSetting: boolean = false): void {
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
if (!config.get<boolean>('closeDiffOnOperation', false) && !ignoreSetting) { return; }
|
||||
|
||||
@@ -1298,11 +1298,11 @@ export class Repository implements Disposable {
|
||||
for (const tab of window.tabGroups.all.map(g => g.tabs).flat()) {
|
||||
const { input } = tab;
|
||||
if (input instanceof TabInputTextDiff || input instanceof TabInputNotebookDiff) {
|
||||
if (input.modified.scheme === 'git' && indexResources.some(r => pathEquals(r, input.modified.fsPath))) {
|
||||
if (input.modified.scheme === 'git' && (indexResources === undefined || indexResources.some(r => pathEquals(r, input.modified.fsPath)))) {
|
||||
// Index
|
||||
diffEditorTabsToClose.push(tab);
|
||||
}
|
||||
if (input.modified.scheme === 'file' && input.original.scheme === 'git' && workingTreeResources.some(r => pathEquals(r, input.modified.fsPath))) {
|
||||
if (input.modified.scheme === 'file' && input.original.scheme === 'git' && (workingTreeResources === undefined || workingTreeResources.some(r => pathEquals(r, input.modified.fsPath)))) {
|
||||
// Working Tree
|
||||
diffEditorTabsToClose.push(tab);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user