mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 17:25:33 -05:00
Adds ability to suppress update notifications
This commit is contained in:
@@ -26,10 +26,11 @@ export const DocumentSchemes = {
|
||||
GitLensGit: 'gitlens-git' as DocumentSchemes
|
||||
};
|
||||
|
||||
export type WorkspaceState = 'repoPath';
|
||||
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice';
|
||||
export const WorkspaceState = {
|
||||
GitLensVersion: 'gitlensVersion' as WorkspaceState,
|
||||
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState
|
||||
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState,
|
||||
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState
|
||||
};
|
||||
|
||||
export const ExtensionId = 'eamodio.gitlens';
|
||||
|
||||
@@ -124,6 +124,8 @@ export async function activate(context: ExtensionContext) {
|
||||
export function deactivate() { }
|
||||
|
||||
async function notifyOnNewGitLensVersion(context: ExtensionContext, version: string) {
|
||||
if (context.globalState.get(WorkspaceState.SuppressUpdateNotice, false)) return;
|
||||
|
||||
const previousVersion = context.globalState.get<string>(WorkspaceState.GitLensVersion);
|
||||
|
||||
await context.globalState.update(WorkspaceState.GitLensVersion, version);
|
||||
@@ -134,10 +136,13 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str
|
||||
if (major === prevMajor && minor === prevMinor) return;
|
||||
}
|
||||
|
||||
const result = await window.showInformationMessage(`GitLens has been updated to v${version}`, 'View Release Notes');
|
||||
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'));
|
||||
}
|
||||
else if (result === `Don't Show Again`) {
|
||||
context.globalState.update(WorkspaceState.SuppressUpdateNotice, true);
|
||||
}
|
||||
}
|
||||
|
||||
async function notifyOnUnsupportedGitVersion(context: ExtensionContext, version: string) {
|
||||
|
||||
Reference in New Issue
Block a user