mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Git - add command to close other repositories (#200893)
This commit is contained in:
parent
29a6631393
commit
81207cddf5
|
@ -98,6 +98,12 @@
|
|||
"category": "Git",
|
||||
"enablement": "!operationInProgress"
|
||||
},
|
||||
{
|
||||
"command": "git.closeOtherRepositories",
|
||||
"title": "%command.closeOtherRepositories%",
|
||||
"category": "Git",
|
||||
"enablement": "!operationInProgress"
|
||||
},
|
||||
{
|
||||
"command": "git.refresh",
|
||||
"title": "%command.refresh%",
|
||||
|
@ -827,6 +833,10 @@
|
|||
"command": "git.close",
|
||||
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
|
||||
},
|
||||
{
|
||||
"command": "git.closeOtherRepositories",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "git.refresh",
|
||||
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
|
||||
|
@ -1336,8 +1346,13 @@
|
|||
"scm/sourceControl": [
|
||||
{
|
||||
"command": "git.close",
|
||||
"group": "navigation",
|
||||
"group": "navigation@1",
|
||||
"when": "scmProvider == git"
|
||||
},
|
||||
{
|
||||
"command": "git.closeOtherRepositories",
|
||||
"group": "navigation@2",
|
||||
"when": "scmProvider == git && gitOpenRepositoryCount > 1"
|
||||
}
|
||||
],
|
||||
"scm/resourceGroup/context": [
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"command.openRepository": "Open Repository",
|
||||
"command.reopenClosedRepositories": "Reopen Closed Repositories...",
|
||||
"command.close": "Close Repository",
|
||||
"command.closeOtherRepositories": "Close Other Repositories",
|
||||
"command.refresh": "Refresh",
|
||||
"command.openChange": "Open Changes",
|
||||
"command.openAllChanges": "Open All Changes",
|
||||
|
|
|
@ -962,6 +962,16 @@ export class CommandCenter {
|
|||
this.model.close(repository);
|
||||
}
|
||||
|
||||
@command('git.closeOtherRepositories', { repository: true })
|
||||
async closeOtherRepositories(repository: Repository): Promise<void> {
|
||||
for (const r of this.model.repositories) {
|
||||
if (r === repository) {
|
||||
continue;
|
||||
}
|
||||
this.model.close(r);
|
||||
}
|
||||
}
|
||||
|
||||
@command('git.openFile')
|
||||
async openFile(arg?: Resource | Uri, ...resourceStates: SourceControlResourceState[]): Promise<void> {
|
||||
const preserveFocus = arg instanceof Resource;
|
||||
|
|
Loading…
Reference in a new issue