Skip to content

Commit 8a188b9

Browse files
committed
fixed sidebar
1 parent 0da1194 commit 8a188b9

2 files changed

Lines changed: 19 additions & 21 deletions

File tree

‎src/extension.ts‎

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Import the necessary modules
22
import * 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
*/

‎src/sidebar.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
}

0 commit comments

Comments
 (0)