From d66fb0f0144c35782d2f153495387102c12c7676 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 27 Jul 2023 10:12:03 -0700 Subject: refactor: :children_crossing: accept 1 version difference before notifying --- extension/src/activation/activate.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'extension/src/activation/activate.ts') diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index 356d0256..430f9f4a 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -15,6 +15,10 @@ export let extensionContext: vscode.ExtensionContext | undefined = undefined; export let ideProtocolClient: IdeProtocolClient; +function getExtensionVersionInt(versionString: string): number { + return parseInt(versionString.replace(/\./g, "")); +} + export async function activateExtension(context: vscode.ExtensionContext) { extensionContext = context; console.log("Using Continue version: ", getExtensionVersion()); @@ -23,7 +27,10 @@ export async function activateExtension(context: vscode.ExtensionContext) { fetch(PACKAGE_JSON_RAW_GITHUB_URL) .then(async (res) => res.json()) .then((packageJson) => { - if (packageJson.version !== getExtensionVersion()) { + const n1 = getExtensionVersionInt(packageJson.version); + const n2 = getExtensionVersionInt(getExtensionVersion()); + if (Math.abs(n1 - n2) > 1) { + // Accept up to 1 version difference vscode.window.showInformationMessage( `You are using an out-of-date version of the Continue extension. Please update to the latest version.` ); -- cgit v1.2.3-70-g09d2