Bläddra i källkod

Adds welcome message for first-time users

main
Eric Amodio 7 år sedan
förälder
incheckning
d01c592533
2 ändrade filer med 20 tillägg och 3 borttagningar
  1. +3
    -2
      src/constants.ts
  2. +17
    -1
      src/extension.ts

+ 3
- 2
src/constants.ts Visa fil

@ -31,9 +31,10 @@ export const DocumentSchemes = {
GitLensGit: 'gitlens-git' as DocumentSchemes
};
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice';
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice' | 'suppressWelcomeNotice';
export const WorkspaceState = {
GitLensVersion: 'gitlensVersion' as WorkspaceState,
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState,
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState,
SuppressWelcomeNotice: 'suppressWelcomeNotice' as WorkspaceState
};

+ 17
- 1
src/extension.ts Visa fil

@ -129,6 +129,20 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str
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);
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`);
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`) {
context.globalState.update(WorkspaceState.SuppressUpdateNotice, true);

Laddar…
Avbryt
Spara