Skip to content

Commit 75b915a

Browse files
committed
Switches to home after install
1 parent 125592b commit 75b915a

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19282,12 +19282,12 @@
1928219282
"viewsWelcome": [
1928319283
{
1928419284
"view": "gitlens.views.scm.grouped",
19285-
"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)",
19285+
"contents": "GitLens groups many related views—Commits, Branches, Stashes, etc—here for easier view management.\n\n[Continue](command:gitlens.views.scm.grouped.welcome.dismiss)\n\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.",
1928619286
"when": "gitlens:views:scm:grouped:welcome && gitlens:newInstall"
1928719287
},
1928819288
{
1928919289
"view": "gitlens.views.scm.grouped",
19290-
"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)",
19290+
"contents": "In GitLens 16, we've grouped many related views—Commits, Branches, Stashes, etc—here for easier view management.\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)\n\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.",
1929119291
"when": "gitlens:views:scm:grouped:welcome && !gitlens:newInstall"
1929219292
},
1929319293
{

src/constants.context.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export type ContextKeys = {
1515
'gitlens:gk:organization:drafts:enabled': boolean;
1616
'gitlens:hasVirtualFolders': boolean;
1717
'gitlens:launchpad:connect': boolean;
18+
/** Indicates that this is a new install of GitLens (on this machine) */
1819
'gitlens:newInstall': boolean;
20+
/** Indicates that this is a new install of GitLens (anywhere for this user -- if synced settings is on) */
21+
'gitlens:newUserInstall': boolean;
1922
'gitlens:plus': SubscriptionPlanId;
2023
'gitlens:plus:disallowedRepos': string[];
2124
'gitlens:plus:enabled': boolean;

src/extension.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,14 @@ export async function activate(context: ExtensionContext): Promise<GitLensApi |
147147
previousVersion = localVersion;
148148
}
149149

150-
if (previousVersion == null) {
150+
// If there is no local previous version, this is a new install on this machine
151+
if (localVersion == null) {
151152
void setContext('gitlens:newInstall', true);
152153
}
154+
// If there is no local or synced previous version, this is a new install for this user
155+
if (previousVersion == null) {
156+
void setContext('gitlens:newUserInstall', true);
157+
}
153158

154159
let exitMessage;
155160
if (Logger.enabled('debug')) {

src/views/views.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ export class Views implements Disposable {
9595
configuration.get('views.scm.grouped.default'),
9696
);
9797
this.updateScmGroupedViewsRegistration();
98+
// If this is a new install, expand the GitLens view and show the home view by default
99+
if (getContext('gitlens:newInstall', false)) {
100+
setTimeout(() => {
101+
executeCoreCommand(`gitlens.views.scm.grouped.focus`, { preserveFocus: true });
102+
executeCoreCommand(`gitlens.views.home.focus`, { preserveFocus: true });
103+
}, 250);
104+
}
98105
}
99106

100107
dispose() {

0 commit comments

Comments
 (0)