mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -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
|
GitLensGit: 'gitlens-git' as DocumentSchemes
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceState = 'repoPath';
|
export type WorkspaceState = 'repoPath' | 'suppressGitVersionWarning' | 'suppressUpdateNotice';
|
||||||
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
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ExtensionId = 'eamodio.gitlens';
|
export const ExtensionId = 'eamodio.gitlens';
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ export async function activate(context: ExtensionContext) {
|
|||||||
export function deactivate() { }
|
export function deactivate() { }
|
||||||
|
|
||||||
async function notifyOnNewGitLensVersion(context: ExtensionContext, version: string) {
|
async function notifyOnNewGitLensVersion(context: ExtensionContext, version: string) {
|
||||||
|
if (context.globalState.get(WorkspaceState.SuppressUpdateNotice, false)) return;
|
||||||
|
|
||||||
const previousVersion = context.globalState.get<string>(WorkspaceState.GitLensVersion);
|
const previousVersion = context.globalState.get<string>(WorkspaceState.GitLensVersion);
|
||||||
|
|
||||||
await context.globalState.update(WorkspaceState.GitLensVersion, version);
|
await context.globalState.update(WorkspaceState.GitLensVersion, version);
|
||||||
@@ -134,10 +136,13 @@ async function notifyOnNewGitLensVersion(context: ExtensionContext, version: str
|
|||||||
if (major === prevMajor && minor === prevMinor) return;
|
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') {
|
if (result === 'View Release Notes') {
|
||||||
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog'));
|
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) {
|
async function notifyOnUnsupportedGitVersion(context: ExtensionContext, version: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user