Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/whats-new' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
benshabatnoam committed Feb 16, 2020
2 parents 20312b2 + 52efc7c commit d1b1c31
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,27 @@ var linesCount: number;
let activeEditor: vscode.TextEditor;

export function activate(context: vscode.ExtensionContext) {
showWhatsNew();
const isShowWhatsNew = context.globalState.get('show-whats-new') ?? true;
if (isShowWhatsNew) {
showWhatsNew(context);
}
let disposable = vscode.commands.registerCommand('extension.translate', onActivate);
context.subscriptions.push(disposable);
}

function showWhatsNew(): void {
function showWhatsNew(context: vscode.ExtensionContext): void {
const panel = vscode.window.createWebviewPanel(
'whatsNew',
`What's New in Google Translate`,
vscode.ViewColumn.One,
{}
);
panel.webview.html = getWebviewContent();
panel.onDidDispose(onWhatsNewClosed.bind(null, context));
}

function onWhatsNewClosed(context: vscode.ExtensionContext) {
context.globalState.update('show-whats-new', false);
}

function getWebviewContent() {
Expand Down

0 comments on commit d1b1c31

Please sign in to comment.