import * as vscode from 'vscode'; export function activate(context: vscode.ExtensionContext) { let openWebview = vscode.commands.registerCommand('exampleApp.openWebview', () => { const panel = vscode.window.createWebviewPanel( 'openWebview', // Identifies the type of the webview. Used internally 'Example Page', // Title of the panel displayed to the user vscode.ViewColumn.One, // Editor column to show the new webview panel in. { // Enable scripts in the webview enableScripts: true //Set this to true if you want to enable Javascript. } ); } context.subscriptions.push(openWebview); } function getWebviewContent() { return `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Example Webview</title> </head> <body> <h1>This works!</h1> //Add some custom HTML here </body> </html>`; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter