From 9b51a8603eea30aaf7e08dc8d47477e1f3498f98 Mon Sep 17 00:00:00 2001 From: Lim Jet <57783762+daoauth@users.noreply.github.com> Date: Thu, 28 Nov 2024 21:22:14 +0900 Subject: [PATCH] update ActivitybarProvider --- src/extension.ts | 10 ++-------- src/webview/activitybarProvider.ts | 13 +++++++++++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 14c2e3c..b3ea275 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,14 +1,8 @@ import * as vscode from 'vscode'; -import { ActivitybarProvider } from './webview/activitybarProvider'; +import { initActivityBar } from './webview/activitybarProvider'; export function activate(context: vscode.ExtensionContext) { - const provider = new ActivitybarProvider(context); - context.subscriptions.push( - vscode.window.registerWebviewViewProvider( - ActivitybarProvider.viewType, - provider, - ), - ); + initActivityBar(context); context.subscriptions.push( vscode.commands.registerCommand('aptos-extension.openDocs', () => { vscode.env.openExternal(vscode.Uri.parse('https://docs.zktx.io')); diff --git a/src/webview/activitybarProvider.ts b/src/webview/activitybarProvider.ts index 59ae969..4d66774 100644 --- a/src/webview/activitybarProvider.ts +++ b/src/webview/activitybarProvider.ts @@ -13,8 +13,7 @@ import { MoveToml, } from './activitybar/src/utilities/cli'; -export class ActivitybarProvider implements vscode.WebviewViewProvider { - public static readonly viewType = 'activitybarProviderAptos'; +class ActivitybarProvider implements vscode.WebviewViewProvider { private _view?: vscode.WebviewView; private readonly _context; @@ -203,3 +202,13 @@ export class ActivitybarProvider implements vscode.WebviewViewProvider { `; } } + +export const initActivityBar = (context: vscode.ExtensionContext) => { + const provider = new ActivitybarProvider(context); + context.subscriptions.push( + vscode.window.registerWebviewViewProvider( + 'activitybarProviderAptos', + provider, + ), + ); +};