- dialogService: 添加智能体 SSE 事件处理 - toolExecutor: 添加 knowledge_save/knowledge_load 工具 - messageArea: 添加智能体消息渲染支持 - 添加 CLAUDE.md 项目配置
2.6 KiB
2.6 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
IC Coder Plugin 是一个 VS Code 扩展,为 Verilog/FPGA 开发提供智能辅助功能,包括代码生成、文件操作、iverilog 仿真和 VCD 波形查看。
Build Commands
# 安装依赖
pnpm install
# 编译 (开发模式)
pnpm run compile
# 监听模式编译
pnpm run watch
# 生产环境打包
pnpm run package
# 代码检查
pnpm run lint
# 运行测试
pnpm run test
# 编译测试文件
pnpm run compile-tests
Development
- 按 F5 在 VS Code 中启动调试模式
- 使用 webpack 打包,入口文件为
src/extension.ts - 输出目录为
dist/
Architecture
src/
├── extension.ts # 插件入口,注册命令和视图
├── panels/
│ ├── ICHelperPanel.ts # 主聊天面板 (WebviewPanel)
│ └── VCDViewerPanel.ts # VCD 波形查看器面板
├── views/
│ ├── ICViewProvider.ts # 侧边栏视图提供者
│ └── webviewContent.ts # Webview HTML 内容 (大文件,使用搜索)
├── utils/
│ ├── messageHandler.ts # 消息处理核心逻辑 (大文件,使用搜索)
│ ├── iverilogRunner.ts # iverilog 编译和仿真执行
│ ├── chatHistoryManager.ts # 会话历史管理
│ ├── createFiles.ts # 文件创建工具
│ └── readFiles.ts # 文件读取工具
├── types/
│ └── chatHistory.ts # 消息类型定义 (LangChain4j 格式)
└── test/ # 测试文件
Key Components
消息流程: Webview -> onDidReceiveMessage -> messageHandler.ts -> 后端处理 -> panel.webview.postMessage -> Webview
消息类型 (src/types/chatHistory.ts):
MessageType.SYSTEM/USER/AI/TOOL_EXECUTION_RESULT- 兼容 LangChain4j 格式
iverilog 集成 (tools/iverilog/):
- 内置 Windows x64 版本的 iverilog/vvp
- 通过
IVERILOG_ROOT环境变量配置库路径 - 支持命令: "生成 VCD"、"运行仿真"、"生成波形"
VS Code Extension Points
- 命令:
ic-coder.openPanel,ic-coder.openChat,ic-coder.openVCDViewer - 侧边栏视图:
ic-coder.mainView - 激活事件:
onLanguage:verilog,onLanguage:vhdl,onStartupFinished
Dependencies
vcdrom,vcd-stream,waveql- VCD 波形处理@wavedrom/doppler,onml- 波形渲染iconv-lite- 编码转换
Notes
webviewContent.ts和messageHandler.ts文件较大,建议使用搜索而非完整读取- 当前仅支持 Windows 平台的 iverilog,其他平台需用户自行安装