-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
showView.ts
60 lines (56 loc) · 1.91 KB
/
showView.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { Commands } from '../constants';
import type { Container } from '../container';
import { command, executeCommand } from '../system/command';
import { Command, CommandContext } from './base';
@command()
export class ShowViewCommand extends Command {
constructor(private readonly container: Container) {
super([
Commands.ShowBranchesView,
Commands.ShowCommitsView,
Commands.ShowContributorsView,
Commands.ShowFileHistoryView,
Commands.ShowLineHistoryView,
Commands.ShowRemotesView,
Commands.ShowRepositoriesView,
Commands.ShowSearchAndCompareView,
Commands.ShowStashesView,
Commands.ShowTagsView,
Commands.ShowWorktreesView,
Commands.ShowHomeView,
]);
}
protected override preExecute(context: CommandContext) {
return this.execute(context.command as Commands);
}
async execute(command: Commands) {
switch (command) {
case Commands.ShowBranchesView:
return this.container.branchesView.show();
case Commands.ShowCommitsView:
return this.container.commitsView.show();
case Commands.ShowContributorsView:
return this.container.contributorsView.show();
case Commands.ShowFileHistoryView:
return this.container.fileHistoryView.show();
case Commands.ShowLineHistoryView:
return this.container.lineHistoryView.show();
case Commands.ShowRemotesView:
return this.container.remotesView.show();
case Commands.ShowRepositoriesView:
return this.container.repositoriesView.show();
case Commands.ShowSearchAndCompareView:
return this.container.searchAndCompareView.show();
case Commands.ShowStashesView:
return this.container.stashesView.show();
case Commands.ShowTagsView:
return this.container.tagsView.show();
case Commands.ShowWorktreesView:
return this.container.worktreesView.show();
case Commands.ShowHomeView:
void (await executeCommand('gitlens.views.home.focus'));
break;
}
return Promise.resolve(undefined);
}
}