feat:将extension文件拆分成不同功能的独立组件

This commit is contained in:
Roe-xin
2025-12-11 10:54:46 +08:00
parent eec915421a
commit b3c8344d82
9 changed files with 547 additions and 40 deletions

View File

@ -1,26 +1,39 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import * as vscode from "vscode";
import { ICViewProvider } from "./views/ICViewProvider";
import { showICHelperPanel } from "./panels/ICHelperPanel";
// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
console.log("🎉 IC Coder 插件已激活!");
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "ic-coder" is now active!');
// 注册命令:打开助手面板
const openPanelCommand = vscode.commands.registerCommand(
"ic-coder.openPanel",
() => {
showICHelperPanel(context);
}
);
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
const disposable = vscode.commands.registerCommand('ic-coder.helloWorld', () => {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
vscode.window.showInformationMessage('Hello World from IC Coder plugin!');
});
// 注册命令:打开聊天(用于侧边栏)
const openChatCommand = vscode.commands.registerCommand(
"ic-coder.openChat",
() => {
showICHelperPanel(context);
}
);
context.subscriptions.push(disposable);
// 注册侧边栏视图
const viewProvider = new ICViewProvider();
const viewRegistration = vscode.window.registerWebviewViewProvider(
"ic-coder.mainView",
viewProvider
);
// 添加到订阅
context.subscriptions.push(
openPanelCommand,
openChatCommand,
viewRegistration
);
}
// This method is called when your extension is deactivated
export function deactivate() {}