From 24ca323557a30b71b46a638f946b394325995e2b Mon Sep 17 00:00:00 2001 From: Amrita kumari mishra Date: Wed, 1 Apr 2026 15:18:19 +0000 Subject: [PATCH 1/3] Fix dashboard refresh command registration --- src/dashboard/dashboard.ts | 87 ++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/src/dashboard/dashboard.ts b/src/dashboard/dashboard.ts index 772b06e94..1c42b6462 100644 --- a/src/dashboard/dashboard.ts +++ b/src/dashboard/dashboard.ts @@ -35,21 +35,11 @@ class DashboardPanel { })); this.setWebviewMessageListener(); this.webView.html = this.getWebviewContent(); - this.disposables.push(vscode.commands.registerCommand('java.dashboard.refresh', async () => { - this.refreshLSInfo(); - })); + this.disposables.push(vscode.commands.registerCommand('java.dashboard.revealFileInOS', async (arg: { path: string }) => { await vscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(arg.path)); })); - - this.disposables.push(vscode.commands.registerCommand('java.dashboard.dumpState', async () => { - const doc = await vscode.workspace.openTextDocument({ - language: 'json', - content: JSON.stringify(currentState, null, 2) - }); - vscode.window.showTextDocument(doc); - })); } private postMessage(message: UpdateMessage) { @@ -134,7 +124,7 @@ class DashboardPanel { `; } - private async refreshLSInfo(): Promise { + public async refreshLSInfo(): Promise { if (!this.webView) { return; } @@ -154,32 +144,49 @@ class DashboardPanel { } export namespace Dashboard { - export function initialize(context: vscode.ExtensionContext): void { - console.log('registering dashboard webview provider'); - let dashboardPanel: DashboardPanel; - let webviewPanel: vscode.WebviewPanel; - - context.subscriptions.push(vscode.commands.registerCommand(Commands.OPEN_JAVA_DASHBOARD, async () => { - if (!dashboardPanel) { - webviewPanel = vscode.window.createWebviewPanel('java.dashboard', 'Java Dashboard', vscode.ViewColumn.Active, { - enableScripts: true, - enableCommandUris: true, - retainContextWhenHidden: true, - localResourceRoots: [context.extensionUri], - }); - webviewPanel.iconPath = Uri.file(path.join(context.extensionPath, 'icons', 'icon128.png')); - dashboardPanel = new DashboardPanel(webviewPanel.webview, context); - - webviewPanel.onDidDispose(() => { - dashboardPanel.dispose(); - dashboardPanel = undefined; - webviewPanel = undefined; - vscode.commands.executeCommand('setContext', 'java:dashboard', false); - }, undefined, context.subscriptions); - } else { - webviewPanel.reveal(); - } - })); - console.log('registered dashboard webview provider'); - } + export function initialize(context: vscode.ExtensionContext): void { + console.log('registering dashboard webview provider'); + + let dashboardPanel: DashboardPanel | undefined = undefined; + let webviewPanel: vscode.WebviewPanel | undefined = undefined; + + context.subscriptions.push(vscode.commands.registerCommand('java.dashboard.refresh', async () => { + await vscode.commands.executeCommand(Commands.OPEN_JAVA_DASHBOARD); + if (dashboardPanel) { + await dashboardPanel.refreshLSInfo(); + } + })); + + context.subscriptions.push(vscode.commands.registerCommand('java.dashboard.dumpState', async () => { + const doc = await vscode.workspace.openTextDocument({ + language: 'json', + content: JSON.stringify(currentState, null, 2) + }); + vscode.window.showTextDocument(doc); + })); + + context.subscriptions.push(vscode.commands.registerCommand(Commands.OPEN_JAVA_DASHBOARD, async () => { + if (!dashboardPanel || !webviewPanel) { + webviewPanel = vscode.window.createWebviewPanel('java.dashboard', 'Java Dashboard', vscode.ViewColumn.Active, { + enableScripts: true, + enableCommandUris: true, + retainContextWhenHidden: true, + localResourceRoots: [context.extensionUri], + }); + + webviewPanel.iconPath = Uri.file(path.join(context.extensionPath, 'icons', 'icon128.png')); + dashboardPanel = new DashboardPanel(webviewPanel.webview, context); + + webviewPanel.onDidDispose(() => { + dashboardPanel?.dispose(); + dashboardPanel = undefined; + webviewPanel = undefined; + vscode.commands.executeCommand('setContext', 'java:dashboard', false); + }, undefined, context.subscriptions); + } else { + webviewPanel.reveal(); + } + })); + console.log('registered dashboard webview provider'); + } } From 428ecadc4aecb4970f2a937ba9f8f77584eb3f99 Mon Sep 17 00:00:00 2001 From: Amrita kumari mishra Date: Wed, 1 Apr 2026 17:46:48 +0000 Subject: [PATCH 2/3] Fix trailing whitespace in dashboard refresh command --- src/dashboard/dashboard.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dashboard/dashboard.ts b/src/dashboard/dashboard.ts index 1c42b6462..fae43769b 100644 --- a/src/dashboard/dashboard.ts +++ b/src/dashboard/dashboard.ts @@ -35,7 +35,7 @@ class DashboardPanel { })); this.setWebviewMessageListener(); this.webView.html = this.getWebviewContent(); - + this.disposables.push(vscode.commands.registerCommand('java.dashboard.revealFileInOS', async (arg: { path: string }) => { await vscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(arg.path)); @@ -146,7 +146,7 @@ class DashboardPanel { export namespace Dashboard { export function initialize(context: vscode.ExtensionContext): void { console.log('registering dashboard webview provider'); - + let dashboardPanel: DashboardPanel | undefined = undefined; let webviewPanel: vscode.WebviewPanel | undefined = undefined; @@ -173,12 +173,12 @@ export namespace Dashboard { retainContextWhenHidden: true, localResourceRoots: [context.extensionUri], }); - + webviewPanel.iconPath = Uri.file(path.join(context.extensionPath, 'icons', 'icon128.png')); dashboardPanel = new DashboardPanel(webviewPanel.webview, context); webviewPanel.onDidDispose(() => { - dashboardPanel?.dispose(); + dashboardPanel?.dispose(); dashboardPanel = undefined; webviewPanel = undefined; vscode.commands.executeCommand('setContext', 'java:dashboard', false); From fb8f94aa591cc7b0525d6077d15dd92b8e7eaf7f Mon Sep 17 00:00:00 2001 From: Amrita kumari mishra Date: Wed, 1 Apr 2026 18:01:03 +0000 Subject: [PATCH 3/3] Update lightweight mode dashboard command test --- test/lightweight-mode-suite/extension.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/lightweight-mode-suite/extension.test.ts b/test/lightweight-mode-suite/extension.test.ts index 1c3f8e08a..6c31c8f59 100644 --- a/test/lightweight-mode-suite/extension.test.ts +++ b/test/lightweight-mode-suite/extension.test.ts @@ -8,7 +8,7 @@ suite('Java Language Extension - LightWeight', () => { suiteSetup(async function() { getJavaConfiguration().update('server.launchMode', 'LightWeight'); - await extensions.getExtension('redhat.java').activate(); + await extensions.getExtension('redhat.java')!.activate(); }); test('should register syntax-only java commands', () => { @@ -30,6 +30,8 @@ suite('Java Language Extension - LightWeight', () => { Commands.FILESEXPLORER_ONPASTE, Commands.CHANGE_JAVA_SEARCH_SCOPE, Commands.OPEN_JAVA_DASHBOARD, + 'java.dashboard.dumpState', + 'java.dashboard.refresh', Commands.ADD_JAVA_RUNTIME ].sort(); const foundJavaCommands = commands.filter((value) => {