mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Adds welcome message for first-time users
This commit is contained in:
@@ -31,9 +31,10 @@ export const DocumentSchemes = {
|
|||||||
GitLensGit: 'gitlens-git' as DocumentSchemes
|
GitLensGit: 'gitlens-git' as DocumentSchemes
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice';
|
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice' | 'suppressWelcomeNotice';
|
||||||
export const WorkspaceState = {
|
export const WorkspaceState = {
|
||||||
GitLensVersion: 'gitlensVersion' as WorkspaceState,
|
GitLensVersion: 'gitlensVersion' as WorkspaceState,
|
||||||
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState,
|
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState,
|
||||||
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState
|
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState,
|
||||||
|
SuppressWelcomeNotice: 'suppressWelcomeNotice' as WorkspaceState
|
||||||
};
|
};
|
||||||
@@ -129,6 +129,20 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str
|
|||||||
|
|
||||||
const previousVersion = context.globalState.get<string>(WorkspaceState.GitLensVersion);
|
const previousVersion = context.globalState.get<string>(WorkspaceState.GitLensVersion);
|
||||||
|
|
||||||
|
if (!context.globalState.get(WorkspaceState.SuppressWelcomeNotice, false)) {
|
||||||
|
await context.globalState.update(WorkspaceState.SuppressWelcomeNotice, true);
|
||||||
|
|
||||||
|
if (previousVersion === undefined) {
|
||||||
|
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');
|
||||||
|
if (result === 'View Docs') {
|
||||||
|
// TODO: Reset before release
|
||||||
|
// commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens'));
|
||||||
|
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/develop/README.md'));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await context.globalState.update(WorkspaceState.GitLensVersion, version);
|
await context.globalState.update(WorkspaceState.GitLensVersion, version);
|
||||||
|
|
||||||
if (previousVersion) {
|
if (previousVersion) {
|
||||||
@@ -139,7 +153,9 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str
|
|||||||
|
|
||||||
const result = await window.showInformationMessage(`GitLens has been updated to v${version}`, 'View Release Notes', `Don't Show Again`);
|
const result = await window.showInformationMessage(`GitLens has been updated to v${version}`, 'View Release Notes', `Don't Show Again`);
|
||||||
if (result === 'View Release Notes') {
|
if (result === 'View Release Notes') {
|
||||||
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog'));
|
// TODO: Reset before release
|
||||||
|
// commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog'));
|
||||||
|
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/develop/CHANGELOG.md'));
|
||||||
}
|
}
|
||||||
else if (result === `Don't Show Again`) {
|
else if (result === `Don't Show Again`) {
|
||||||
context.globalState.update(WorkspaceState.SuppressUpdateNotice, true);
|
context.globalState.update(WorkspaceState.SuppressUpdateNotice, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user