feat: 更新Webview视图提供者,优化HTML内容生成和通知服务逻辑

This commit is contained in:
Roe-xin
2026-01-28 21:38:49 +08:00
parent 7c4ecb013e
commit 4f1d7f495a
4 changed files with 130 additions and 200 deletions

View File

@ -1,8 +1,14 @@
import * as vscode from 'vscode';
import * as path from 'path';
// 使用 require 导入 node-notifier
const notifier = require('node-notifier');
// 尝试加载 node-notifier,如果失败则使用 null
let notifier: any = null;
try {
notifier = require('node-notifier');
console.log('[NotificationService] node-notifier 加载成功');
} catch (error) {
console.log('[NotificationService] node-notifier 加载失败,将只使用 VS Code 内置通知');
}
/**
* 通知类型枚举
@ -114,6 +120,13 @@ export class NotificationService {
}
console.log('[NotificationService] 通过防抖检查');
// 如果 node-notifier 不可用,直接使用 VS Code 内置通知
if (!notifier) {
console.log('[NotificationService] node-notifier 不可用,使用 VS Code 内置通知');
this.showVSCodeNotification(title, message, type, onClick);
return;
}
// 使用 node-notifier 发送系统通知
console.log('[NotificationService] 使用 node-notifier 发送系统通知');