From 4f1266f369a1a82ce5c17a2459fb731941b1b4ce Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Sat, 29 Jun 2019 00:10:15 +0200 Subject: Release 0.5.0 --- src/extension.ts | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/extension.ts b/src/extension.ts index 347b392..8199845 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,12 +1,19 @@ "use strict"; // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below +import * as opn from "opn"; import * as vscode from "vscode"; import CodeParserController from "./CodeParserController"; +enum AlignmentNotificationOptions { + CHANGED = "Show me how to do that", + HIDE = "Don't show me again", + GLOBAL_STORAGE_KEY = "doxdocgen_hide_alignment_notification", +} + enum Version { - CURRENT = "0.4.3", - PREVIOUS = "0.4.2", + CURRENT = "0.5.0", + PREVIOUS = "0.4.3", KEY = "doxdocgen_version", } @@ -17,10 +24,35 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(parser); + let change: boolean = false; const version = context.globalState.get(Version.KEY); if (version === undefined) { context.globalState.update(Version.KEY, Version.CURRENT); } else if (version !== Version.CURRENT) { + if (parseInt(version.split(".")[1], 10) < 5) { + change = true; + } context.globalState.update(Version.KEY, Version.CURRENT); } + let notificationHideThenable: Thenable; + const active = context.globalState.get(AlignmentNotificationOptions.GLOBAL_STORAGE_KEY); + if (change && (active === undefined || active !== "false")) { + // tslint:disable-next-line:max-line-length + notificationHideThenable = + vscode.window.showWarningMessage("DoxDocGen: I can now align your comments", + AlignmentNotificationOptions.CHANGED, + AlignmentNotificationOptions.HIDE); + } + + if (notificationHideThenable !== undefined) { + notificationHideThenable.then((action) => { + if (action === AlignmentNotificationOptions.CHANGED) { + // tslint:disable-next-line:max-line-length + opn("https://github.com/christophschlosser/doxdocgen/blob/master/CHANGELOG.md#alignment"); + } else if (action === AlignmentNotificationOptions.HIDE) { + context.globalState.update(AlignmentNotificationOptions.GLOBAL_STORAGE_KEY, "false"); + } + }); + } + } -- cgit v1.2.3