Skip to content

Commit d07e231

Browse files
committed
Fixes many more issues w/welcome blocking
1 parent ac1633c commit d07e231

File tree

5 files changed

+198
-109
lines changed

5 files changed

+198
-109
lines changed

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19159,6 +19159,16 @@
1915919159
]
1916019160
},
1916119161
"viewsWelcome": [
19162+
{
19163+
"view": "gitlens.views.scm.grouped",
19164+
"contents": "GitLens groups many related views—Commits, Branches, Stashes, etc—here for easier view management.\nUse the tabs above to navigate, or detach the views you want to keep separated. You can regroup them anytime using the 'x' in the view header.\n\n[Continue](command:gitlens.views.scm.grouped.welcome.dismiss)",
19165+
"when": "!gitlens:views:scm:grouped:welcome:dismissed && gitlens:newInstall"
19166+
},
19167+
{
19168+
"view": "gitlens.views.scm.grouped",
19169+
"contents": "In GitLens 16, we've grouped many related views—Commits, Branches, Stashes, etc—here for easier view management.\nUse the tabs above to navigate, or detach the views you want to keep separated. You can regroup them anytime using the 'x' in the view header.\n\n[Continue](command:gitlens.views.scm.grouped.welcome.dismiss)\n\nPrefer them separate? [Restore views to previous locations](command:gitlens.views.scm.grouped.welcome.restore)",
19170+
"when": "!gitlens:views:scm:grouped:welcome:dismissed && !gitlens:newInstall"
19171+
},
1916219172
{
1916319173
"view": "gitlens.views.searchAndCompare",
1916419174
"contents": "Search for commits by [message](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22message%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [author](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22author%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [SHA](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22commit%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [file](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22file%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), or [changes](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22change%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D)\n\n[Search Commits...](command:gitlens.views.searchAndCompare.searchCommits)",
@@ -19441,16 +19451,6 @@
1944119451
"view": "gitlens.views.scm.grouped",
1944219452
"contents": "Pro feature — requires a paid plan for use on privately-hosted repos.",
1944319453
"when": "gitlens:views:scm:grouped:view == worktrees"
19444-
},
19445-
{
19446-
"view": "gitlens.views.scm.grouped",
19447-
"contents": "GitLens groups many related views—Commits, Branches, Stashes, etc—here for easier view management.\nUse the tabs above to navigate, or detach the views you want to keep separated. You can regroup them anytime using the 'x' in the view header.\n\n[Continue](command:gitlens.views.scm.grouped.welcome.dismiss)",
19448-
"when": "!gitlens:views:scm:grouped:welcome:dismissed && gitlens:newInstall"
19449-
},
19450-
{
19451-
"view": "gitlens.views.scm.grouped",
19452-
"contents": "In GitLens 16, we've grouped many related views—Commits, Branches, Stashes, etc—here for easier view management.\nUse the tabs above to navigate, or detach the views you want to keep separated. You can regroup them anytime using the 'x' in the view header.\n\n[Continue](command:gitlens.views.scm.grouped.welcome.dismiss)\n\nPrefer them separate? [Restore views to previous locations](command:gitlens.views.scm.grouped.welcome.restore)",
19453-
"when": "!gitlens:views:scm:grouped:welcome:dismissed && !gitlens:newInstall"
1945419454
}
1945519455
],
1945619456
"views": {

src/commands/showView.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,41 @@ export class ShowViewCommand extends Command {
4545
...([{ focusAccount: true }, ...args] as HomeWebviewShowingArgs),
4646
);
4747
case Commands.ShowBranchesView:
48-
return this.container.views.branches.show();
48+
return this.container.views.showView('branches');
4949
case Commands.ShowCommitDetailsView:
5050
return this.container.views.commitDetails.show();
5151
case Commands.ShowCommitsView:
52-
return this.container.views.commits.show();
52+
return this.container.views.showView('commits');
5353
case Commands.ShowContributorsView:
54-
return this.container.views.contributors.show();
54+
return this.container.views.showView('contributors');
5555
case Commands.ShowDraftsView:
56-
return this.container.views.drafts.show();
56+
return this.container.views.showView('drafts');
5757
case Commands.ShowFileHistoryView:
58-
return this.container.views.fileHistory.show();
58+
return this.container.views.showView('fileHistory');
5959
case Commands.ShowGraphView:
6060
return this.container.views.graph.show(undefined, ...(args as GraphWebviewShowingArgs));
6161
case Commands.ShowHomeView:
6262
return this.container.views.home.show(undefined, ...(args as HomeWebviewShowingArgs));
6363
case Commands.ShowLaunchpadView:
64-
return this.container.views.launchpad.show();
64+
return this.container.views.showView('launchpad');
6565
case Commands.ShowLineHistoryView:
66-
return this.container.views.lineHistory.show();
66+
return this.container.views.showView('lineHistory');
6767
case Commands.ShowRemotesView:
68-
return this.container.views.remotes.show();
68+
return this.container.views.showView('remotes');
6969
case Commands.ShowRepositoriesView:
70-
return this.container.views.repositories.show();
70+
return this.container.views.showView('repositories');
7171
case Commands.ShowSearchAndCompareView:
72-
return this.container.views.searchAndCompare.show();
72+
return this.container.views.showView('searchAndCompare');
7373
case Commands.ShowStashesView:
74-
return this.container.views.stashes.show();
74+
return this.container.views.showView('stashes');
7575
case Commands.ShowTagsView:
76-
return this.container.views.tags.show();
76+
return this.container.views.showView('tags');
7777
case Commands.ShowTimelineView:
7878
return this.container.views.timeline.show();
7979
case Commands.ShowWorktreesView:
80-
return this.container.views.worktrees.show();
80+
return this.container.views.showView('worktrees');
8181
case Commands.ShowWorkspacesView:
82-
return this.container.views.workspaces.show();
82+
return this.container.views.showView('workspaces');
8383
}
8484

8585
return Promise.resolve(undefined);

src/views/scmGroupedView.ts

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { Disposable } from 'vscode';
2-
import type { Commands } from '../constants.commands';
1+
import type { Disposable } from 'vscode';
32
import type { GroupableTreeViewTypes } from '../constants.views';
43
import type { Container } from '../container';
54
import { first } from '../system/iterable';
6-
import { executeCommand, registerCommand } from '../system/vscode/command';
75
import { BranchesView } from './branchesView';
86
import { CommitsView } from './commitsView';
97
import { ContributorsView } from './contributorsView';
@@ -18,42 +16,26 @@ import type { Views } from './views';
1816
import { WorktreesView } from './worktreesView';
1917

2018
export class ScmGroupedView implements Disposable {
21-
private _disposable: Disposable;
2219
private _view: TreeViewByType[GroupableTreeViewTypes] | undefined;
2320

2421
constructor(
2522
private readonly container: Container,
2623
private views: Views,
2724
) {
28-
this._disposable = Disposable.from(
29-
registerCommand('gitlens.views.scm.grouped.refresh', () => {
30-
if (this._view == null) return;
31-
32-
executeCommand(`gitlens.views.${this._view.type}.refresh` as Commands);
33-
}),
34-
registerCommand('gitlens.views.scm.grouped.branches', () => this.setView('branches', true)),
35-
registerCommand('gitlens.views.scm.grouped.commits', () => this.setView('commits', true)),
36-
registerCommand('gitlens.views.scm.grouped.contributors', () => this.setView('contributors', true)),
37-
registerCommand('gitlens.views.scm.grouped.launchpad', () => this.setView('launchpad', true)),
38-
registerCommand('gitlens.views.scm.grouped.remotes', () => this.setView('remotes', true)),
39-
registerCommand('gitlens.views.scm.grouped.repositories', () => this.setView('repositories', true)),
40-
registerCommand('gitlens.views.scm.grouped.searchAndCompare', () => this.setView('searchAndCompare', true)),
41-
registerCommand('gitlens.views.scm.grouped.stashes', () => this.setView('stashes', true)),
42-
registerCommand('gitlens.views.scm.grouped.tags', () => this.setView('tags', true)),
43-
registerCommand('gitlens.views.scm.grouped.worktrees', () => this.setView('worktrees', true)),
44-
);
45-
4625
this._view = this.setView(this.views.lastSelectedScmGroupedView!);
4726
}
4827

4928
dispose() {
50-
this._disposable.dispose();
5129
this._view?.dispose();
5230
}
5331

32+
get view() {
33+
return this._view;
34+
}
35+
5436
setView<T extends GroupableTreeViewTypes>(type: T, focus?: boolean): TreeViewByType[T] {
55-
if (!this.views.scmGroupedViews.has(type)) {
56-
type = first(this.views.scmGroupedViews) as T;
37+
if (!this.views.scmGroupedViews?.has(type)) {
38+
type = this.views.scmGroupedViews?.size ? (first(this.views.scmGroupedViews) as T) : undefined!;
5739
}
5840

5941
if (this._view?.type === type) {

src/views/viewBase.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import type {
3333
import { viewsCommonConfigKeys, viewsConfigKeys } from '../config';
3434
import type { TreeViewCommandSuffixesByViewType } from '../constants.commands';
3535
import type { TrackedUsageFeatures } from '../constants.telemetry';
36-
import type { TreeViewIds, TreeViewTypes } from '../constants.views';
36+
import type { TreeViewIds, TreeViewTypes, WebviewViewTypes } from '../constants.views';
3737
import type { Container } from '../container';
3838
import { debug, log } from '../system/decorators/log';
3939
import { once } from '../system/event';
@@ -113,6 +113,23 @@ export type TreeViewByType = {
113113
: View;
114114
};
115115

116+
// prettier-ignore
117+
export type WebviewViewByType = {
118+
[T in WebviewViewTypes]: T extends 'commitDetails'
119+
? CommitsView
120+
: T extends 'graph'
121+
? CommitsView
122+
: T extends 'graphDetails'
123+
? CommitsView
124+
: T extends 'home'
125+
? CommitsView
126+
: T extends 'patchDetails'
127+
? CommitsView
128+
: T extends 'timeline'
129+
? CommitsView
130+
: View;
131+
};
132+
116133
export type ViewsWithBranches = BranchesView | CommitsView | RemotesView | RepositoriesView | WorkspacesView;
117134
export type ViewsWithBranchesNode = BranchesView | RepositoriesView | WorkspacesView;
118135
export type ViewsWithCommits = Exclude<View, LineHistoryView | StashesView>;

0 commit comments

Comments
 (0)