Skip to content

Commit 5d5fffb

Browse files
committed
Adds a Show Launchpad view command
1 parent 36d498f commit 5d5fffb

File tree

4 files changed

+41
-11
lines changed

4 files changed

+41
-11
lines changed

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5767,6 +5767,12 @@
57675767
"category": "GitLens",
57685768
"icon": "$(rocket)"
57695769
},
5770+
{
5771+
"command": "gitlens.showLaunchpadView",
5772+
"title": "Show Launchpad View",
5773+
"category": "GitLens",
5774+
"icon": "$(rocket)"
5775+
},
57705776
{
57715777
"command": "gitlens.showFocusPage",
57725778
"title": "Open Launchpad in Editor",
@@ -9861,6 +9867,10 @@
98619867
"command": "gitlens.showLaunchpad",
98629868
"when": "gitlens:enabled"
98639869
},
9870+
{
9871+
"command": "gitlens.showLaunchpadView",
9872+
"when": "gitlens:enabled"
9873+
},
98649874
{
98659875
"command": "gitlens.showFocusPage",
98669876
"when": "gitlens:enabled"

src/commands/showView.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Command } from './base';
99
export class ShowViewCommand extends Command {
1010
constructor(private readonly container: Container) {
1111
super([
12+
Commands.ShowAccountView,
1213
Commands.ShowBranchesView,
1314
Commands.ShowCommitDetailsView,
1415
Commands.ShowCommitsView,
@@ -17,7 +18,7 @@ export class ShowViewCommand extends Command {
1718
Commands.ShowFileHistoryView,
1819
Commands.ShowGraphView,
1920
Commands.ShowHomeView,
20-
Commands.ShowAccountView,
21+
Commands.ShowLaunchpadView,
2122
Commands.ShowLineHistoryView,
2223
Commands.ShowRemotesView,
2324
Commands.ShowRepositoriesView,
@@ -37,6 +38,8 @@ export class ShowViewCommand extends Command {
3738
async execute(context: CommandContext, ...args: unknown[]) {
3839
const command = context.command as Commands;
3940
switch (command) {
41+
case Commands.ShowAccountView:
42+
return this.container.accountView.show();
4043
case Commands.ShowBranchesView:
4144
return this.container.branchesView.show();
4245
case Commands.ShowCommitDetailsView:
@@ -49,12 +52,12 @@ export class ShowViewCommand extends Command {
4952
return this.container.draftsView.show();
5053
case Commands.ShowFileHistoryView:
5154
return this.container.fileHistoryView.show();
52-
case Commands.ShowHomeView:
53-
return this.container.homeView.show();
54-
case Commands.ShowAccountView:
55-
return this.container.accountView.show();
5655
case Commands.ShowGraphView:
5756
return this.container.graphView.show(undefined, ...(args as GraphWebviewShowingArgs));
57+
case Commands.ShowHomeView:
58+
return this.container.homeView.show();
59+
case Commands.ShowLaunchpadView:
60+
return this.container.launchpadView.show();
5861
case Commands.ShowLineHistoryView:
5962
return this.container.lineHistoryView.show();
6063
case Commands.ShowRemotesView:

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ export const enum Commands {
325325
ShowInTimeline = 'gitlens.showInTimeline',
326326
ShowLastQuickPick = 'gitlens.showLastQuickPick',
327327
ShowLaunchpad = 'gitlens.showLaunchpad',
328+
ShowLaunchpadView = 'gitlens.showLaunchpadView',
328329
ShowLineCommitInView = 'gitlens.showLineCommitInView',
329330
ShowLineHistoryView = 'gitlens.showLineHistoryView',
330331
OpenOnlyChangedFiles = 'gitlens.openOnlyChangedFiles',

src/views/launchpadView.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { ConfigurationChangeEvent, TreeViewVisibilityChangeEvent } from 'vscode';
2-
import { Disposable, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
1+
import type { ConfigurationChangeEvent, MessageItem, TreeViewVisibilityChangeEvent } from 'vscode';
2+
import { Disposable, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri, window } from 'vscode';
33
import type { OpenWalkthroughCommandArgs } from '../commands/walkthroughs';
44
import type { LaunchpadViewConfig, ViewFilesLayout } from '../config';
55
import { Commands, experimentalBadge } from '../constants';
@@ -192,11 +192,27 @@ export class LaunchpadView extends ViewBase<'launchpad', LaunchpadViewNode, Laun
192192
super.onVisibilityChanged(e);
193193
}
194194

195-
// override async show(options?: { preserveFocus?: boolean | undefined }): Promise<void> {
196-
// if (!(await ensurePlusFeaturesEnabled())) return;
195+
override async show(options?: { preserveFocus?: boolean | undefined }): Promise<void> {
196+
if (!configuration.get('views.launchpad.enabled')) {
197+
const confirm: MessageItem = { title: 'Enable' };
198+
const cancel: MessageItem = { title: 'Cancel', isCloseAffordance: true };
199+
const result = await window.showInformationMessage(
200+
'Would you like to try the new experimental Launchpad view?',
201+
{
202+
modal: true,
203+
detail: 'Launchpad organizes your pull requests into actionable groups to help you focus and keep your team unblocked.',
204+
},
205+
confirm,
206+
cancel,
207+
);
208+
209+
if (result !== confirm) return;
197210

198-
// return super.show(options);
199-
// }
211+
await configuration.updateEffective('views.launchpad.enabled', true);
212+
}
213+
214+
return super.show(options);
215+
}
200216

201217
override get canReveal(): boolean {
202218
return false;

0 commit comments

Comments
 (0)