feat:给编辑面板标签页替换icon + 编辑页面新增icon

This commit is contained in:
Roe-xin
2025-12-11 14:33:19 +08:00
parent 49b3e34101
commit 95342ecbec
2 changed files with 15 additions and 3 deletions

View File

@ -14,11 +14,20 @@ export function showICHelperPanel(context: vscode.ExtensionContext) {
{ {
enableScripts: true, enableScripts: true,
retainContextWhenHidden: true, retainContextWhenHidden: true,
localResourceRoots: [vscode.Uri.joinPath(context.extensionUri, "media")],
} }
); );
// 设置标签页图标
panel.iconPath = vscode.Uri.joinPath(context.extensionUri, "media", "图案(方底).png");
// 获取页面内图标URI
const iconUri = panel.webview.asWebviewUri(
vscode.Uri.joinPath(context.extensionUri, "media", "图案(方底).png")
);
// 设置HTML内容 // 设置HTML内容
panel.webview.html = getWebviewContent(); panel.webview.html = getWebviewContent(iconUri.toString());
// 处理消息 // 处理消息
panel.webview.onDidReceiveMessage( panel.webview.onDidReceiveMessage(

View File

@ -1,7 +1,7 @@
/** /**
* 获取 WebView 面板的 HTML 内容 * 获取 WebView 面板的 HTML 内容
*/ */
export function getWebviewContent(): string { export function getWebviewContent(iconUri?: string): string {
return `<!DOCTYPE html> return `<!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
@ -149,7 +149,10 @@ export function getWebviewContent(): string {
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<h1>IC Coder</h1> <div style="display: flex; align-items: center; justify-content: center; gap: 10px;">
<img src="${iconUri}" alt="IC Coder" style="width: 28px; height: 28px;" />
<h1 style="margin: 0;">IC Coder</h1>
</div>
<p>专注于真实FPGA研发的Verilog智能体编程平台</p> <p>专注于真实FPGA研发的Verilog智能体编程平台</p>
</div> </div>