From f1cc2b401e2317f0ff3e30d4f019139e9c7a7619 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:49:56 -0400 Subject: [PATCH] Use Simple Browser instead of webview to show vendordep instructions --- vscode-wpilib/package.json | 8 +--- vscode-wpilib/src/dependencyView.ts | 6 +-- vscode-wpilib/src/extension.ts | 61 ----------------------------- 3 files changed, 2 insertions(+), 73 deletions(-) diff --git a/vscode-wpilib/package.json b/vscode-wpilib/package.json index 1ea6402c..972d7460 100644 --- a/vscode-wpilib/package.json +++ b/vscode-wpilib/package.json @@ -55,8 +55,7 @@ "onCommand:wpilibcore.openApiDocumentation", "onCommand:wpilibcore.getProjectInformation", "onCommand:wpilibcore.runGradleClean", - "onCommand:wpilib.refreshVendordeps", - "onCommand:extension.showWebsite" + "onCommand:wpilib.refreshVendordeps" ], "main": "./out/extension", "contributes": { @@ -419,12 +418,7 @@ "command": "wpilib.refreshVendordeps", "title": "Refresh", "icon": "$(refresh)" - }, - { - "command": "extension.showWebsite", - "title": "Show Website" } - ], "views": { "explorer": [ diff --git a/vscode-wpilib/src/dependencyView.ts b/vscode-wpilib/src/dependencyView.ts index a4134495..04de2e6d 100644 --- a/vscode-wpilib/src/dependencyView.ts +++ b/vscode-wpilib/src/dependencyView.ts @@ -234,11 +234,7 @@ export class DependencyViewProvider implements vscode.WebviewViewProvider { if (success) { if (avail.instructions) { - await vscode.commands.executeCommand( - 'extension.showWebsite', - avail.instructions, - dep.name - ); + await vscode.commands.executeCommand('simpleBrowser.show', avail.instructions); } this.changed = Date.now(); diff --git a/vscode-wpilib/src/extension.ts b/vscode-wpilib/src/extension.ts index 1a33a12a..3790c2ee 100644 --- a/vscode-wpilib/src/extension.ts +++ b/vscode-wpilib/src/extension.ts @@ -538,38 +538,6 @@ export async function activate(context: vscode.ExtensionContext) { gradle2025import, help ); - - // Register the command with arguments - let disposable = vscode.commands.registerCommand( - 'extension.showWebsite', - (url: string, tabTitle: string) => { - // If no arguments were passed, you can prompt the user (optional): - if (!url) { - vscode.window.showErrorMessage('URL not provided!'); - return; - } - if (!tabTitle) { - tabTitle = 'My Website'; // fallback title if not provided - } - - // Create and show a new webview panel - const panel = vscode.window.createWebviewPanel( - 'myWebview', // internal identifier - tabTitle, // use the dynamic title - vscode.ViewColumn.One, - { - enableScripts: true, - retainContextWhenHidden: true, - } - ); - - // Set the HTML content of the webview - panel.webview.html = getWebviewContent(url); - } - ); - - context.subscriptions.push(disposable); - return externalApi; } @@ -577,32 +545,3 @@ export async function activate(context: vscode.ExtensionContext) { export function deactivate() { closeLogger(); } - -function getWebviewContent(url: string): string { - // Basic HTML that includes an iframe to your target website. - // NOTE: This will only work if the site allows iframes. - return ` - -
- - - - - - - - `; -}