Skip to content

Commit 5af70fd

Browse files
committed
Adds welcome message for first-time users
1 parent cecd352 commit 5af70fd

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ export const DocumentSchemes = {
3131
GitLensGit: 'gitlens-git' as DocumentSchemes
3232
};
3333

34-
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice';
34+
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice' | 'suppressWelcomeNotice';
3535
export const WorkspaceState = {
3636
GitLensVersion: 'gitlensVersion' as WorkspaceState,
3737
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState,
38-
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState
38+
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState,
39+
SuppressWelcomeNotice: 'suppressWelcomeNotice' as WorkspaceState
3940
};

src/extension.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,20 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str
129129

130130
const previousVersion = context.globalState.get<string>(WorkspaceState.GitLensVersion);
131131

132+
if (!context.globalState.get(WorkspaceState.SuppressWelcomeNotice, false)) {
133+
await context.globalState.update(WorkspaceState.SuppressWelcomeNotice, true);
134+
135+
if (previousVersion === undefined) {
136+
const result = await window.showInformationMessage(`Thank you for choosing GitLens! GitLens is powerful, feature rich, and highly configurable, so please be sure to view the docs and tailor it to suit your needs.`, 'View Docs');
137+
if (result === 'View Docs') {
138+
// TODO: Reset before release
139+
// commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens'));
140+
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/develop/README.md'));
141+
}
142+
return;
143+
}
144+
}
145+
132146
await context.globalState.update(WorkspaceState.GitLensVersion, version);
133147

134148
if (previousVersion) {
@@ -139,7 +153,9 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str
139153

140154
const result = await window.showInformationMessage(`GitLens has been updated to v${version}`, 'View Release Notes', `Don't Show Again`);
141155
if (result === 'View Release Notes') {
142-
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog'));
156+
// TODO: Reset before release
157+
// commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog'));
158+
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/develop/CHANGELOG.md'));
143159
}
144160
else if (result === `Don't Show Again`) {
145161
context.globalState.update(WorkspaceState.SuppressUpdateNotice, true);

0 commit comments

Comments
 (0)