Save lastVersion in global state

feature/ssh-config
Kelvin Schoofs 4 years ago
parent a78f3cdefe
commit fdb3b6685b

@ -12,7 +12,7 @@ import { pickComplex, PickComplexOptions, pickConnection, setAsAbsolutePath } fr
function getVersion(): string | undefined { function getVersion(): string | undefined {
const ext = vscode.extensions.getExtension('Kelvin.vscode-sshfs'); const ext = vscode.extensions.getExtension('Kelvin.vscode-sshfs');
return ext && ext.packageJSON && ext.packageJSON.version; return ext?.packageJSON?.version;
} }
interface CommandHandler { interface CommandHandler {
@ -31,6 +31,17 @@ export function activate(context: vscode.ExtensionContext) {
setDebug(context.extensionMode !== vscode.ExtensionMode.Production); 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<string>('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 // 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 // I really don't like having to pass context to *everything*, so let's do it this way
setAsAbsolutePath(context.asAbsolutePath.bind(context)); setAsAbsolutePath(context.asAbsolutePath.bind(context));

Loading…
Cancel
Save