From fdb3b6685b242d71d72f0548ce9b5dce559df610 Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Mon, 5 Apr 2021 14:57:55 +0200 Subject: [PATCH] Save lastVersion in global state --- src/extension.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 1e7dc89..8051265 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -12,7 +12,7 @@ import { pickComplex, PickComplexOptions, pickConnection, setAsAbsolutePath } fr function getVersion(): string | undefined { const ext = vscode.extensions.getExtension('Kelvin.vscode-sshfs'); - return ext && ext.packageJSON && ext.packageJSON.version; + return ext?.packageJSON?.version; } interface CommandHandler { @@ -31,6 +31,17 @@ export function activate(context: vscode.ExtensionContext) { setDebug(context.extensionMode !== vscode.ExtensionMode.Production); + // Likely that we'll have a breaking change in the future that requires users to check + // their configs, or at least reconfigure already existing workspaces with new URIs. + // See https://github.com/SchoofsKelvin/vscode-sshfs/issues/198#issuecomment-785926352 + const previousVersion = context.globalState.get('lastVersion'); + context.globalState.update('lastVersion', getVersion()); + if (!previousVersion) { + Logging.info('No previous version detected. Fresh or pre-v1.21.0 installation?'); + } else if (previousVersion !== getVersion()) { + Logging.info(`Previously used version ${previousVersion}, first run after install.`); + } + // Really too bad we *need* the ExtensionContext for relative resources // I really don't like having to pass context to *everything*, so let's do it this way setAsAbsolutePath(context.asAbsolutePath.bind(context));