|
|
@ -1,4 +1,6 @@ |
|
|
|
'use strict'; |
|
|
|
import { commands } from 'vscode'; |
|
|
|
import { configuration } from '../configuration'; |
|
|
|
import { Container } from '../container'; |
|
|
|
import { command, Command, CommandContext, Commands } from './common'; |
|
|
|
|
|
|
@ -6,10 +8,17 @@ import { command, Command, CommandContext, Commands } from './common'; |
|
|
|
export class ShowViewCommand extends Command { |
|
|
|
constructor() { |
|
|
|
super([ |
|
|
|
Commands.ShowBranchesView, |
|
|
|
Commands.ShowCommitsView, |
|
|
|
Commands.ShowContributorsView, |
|
|
|
Commands.ShowFileHistoryView, |
|
|
|
Commands.ShowLineHistoryView, |
|
|
|
Commands.ShowRemotesView, |
|
|
|
Commands.ShowRepositoriesView, |
|
|
|
Commands.ShowSearchAndCompareView, |
|
|
|
Commands.ShowStashesView, |
|
|
|
Commands.ShowTagsView, |
|
|
|
Commands.ShowWelcomeView, |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
@ -17,16 +26,39 @@ export class ShowViewCommand extends Command { |
|
|
|
return this.execute(context.command as Commands); |
|
|
|
} |
|
|
|
|
|
|
|
execute(command: Commands) { |
|
|
|
async execute(command: Commands) { |
|
|
|
switch (command) { |
|
|
|
case Commands.ShowBranchesView: |
|
|
|
return Container.branchesView.show(); |
|
|
|
case Commands.ShowCommitsView: |
|
|
|
return Container.commitsView.show(); |
|
|
|
case Commands.ShowContributorsView: |
|
|
|
return Container.contributorsView.show(); |
|
|
|
case Commands.ShowFileHistoryView: |
|
|
|
return Container.fileHistoryView.show(); |
|
|
|
case Commands.ShowLineHistoryView: |
|
|
|
if (!Container.config.views.lineHistory.enabled) { |
|
|
|
await configuration.updateEffective('views', 'lineHistory', 'enabled', true); |
|
|
|
} |
|
|
|
return Container.lineHistoryView.show(); |
|
|
|
case Commands.ShowRemotesView: |
|
|
|
return Container.remotesView.show(); |
|
|
|
case Commands.ShowRepositoriesView: |
|
|
|
if (!Container.config.views.lineHistory.enabled) { |
|
|
|
await configuration.updateEffective('views', 'repositories', 'enabled', true); |
|
|
|
} |
|
|
|
return Container.repositoriesView.show(); |
|
|
|
case Commands.ShowSearchAndCompareView: |
|
|
|
return Container.searchAndCompareView.show(); |
|
|
|
case Commands.ShowStashesView: |
|
|
|
return Container.stashesView.show(); |
|
|
|
case Commands.ShowTagsView: |
|
|
|
return Container.tagsView.show(); |
|
|
|
case Commands.ShowWelcomeView: |
|
|
|
if (!Container.config.views.welcome.enabled) { |
|
|
|
await configuration.updateEffective('views', 'welcome', 'enabled', true); |
|
|
|
} |
|
|
|
void (await commands.executeCommand('gitlens.views.welcome.focus')); |
|
|
|
} |
|
|
|
|
|
|
|
return Promise.resolve(undefined); |
|
|
|