File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Import the necessary modules
22import * as vscode from 'vscode' ;
3+ import { getWebviewContent } from './sidebar' ;
34
45/**
56 * This method is called when the extension is activated.
@@ -13,7 +14,7 @@ function activate(context: vscode.ExtensionContext) {
1314 const panel = vscode . window . createWebviewPanel (
1415 'pythonSidebar' , // Identifier for the view
1516 'Python Sidebar' , // Title of the panel
16- vscode . ViewColumn . Active , // Show the panel beside the code editor
17+ vscode . ViewColumn . Beside , // Show the panel beside the code editor
1718 {
1819 // Options for the Webview
1920 enableScripts : true ,
@@ -36,26 +37,6 @@ function activate(context: vscode.ExtensionContext) {
3637 context . subscriptions . push ( disposable ) ;
3738}
3839
39- /**
40- * Provides the HTML content for the code editor side panel.
41- * @returns {string } HTML content.
42- */
43- function getWebviewContent ( ) {
44- return `
45- <!DOCTYPE html>
46- <html lang="en">
47- <head>
48- <meta charset="UTF-8">
49- <meta name="viewport" content="width=device-width, initial-scale=1.0">
50- <title>Hello World</title>
51- </head>
52- <body>
53- <h1>Hello World</h1>
54- </body>
55- </html>
56- ` ;
57- }
58-
5940/**
6041 * This method is called when the extension is deactivated.
6142 */
Original file line number Diff line number Diff line change 1+ // src/sidebar.ts
2+ export function getWebviewContent ( ) : string {
3+ return `
4+ <!DOCTYPE html>
5+ <html lang="en">
6+ <head>
7+ <meta charset="UTF-8">
8+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
9+ <title>Python Sidebar</title>
10+ </head>
11+ <body>
12+ <h1>Welcome to the Python Sidebar</h1>
13+ <p>This is a custom sidebar for Python files.</p>
14+ </body>
15+ </html>
16+ ` ;
17+ }
You can’t perform that action at this time.
0 commit comments