Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Pubinfo AINew to Visual Studio Code? Get it now.
Pubinfo AI

Pubinfo AI

elonehoo

|
2 installs
| (0) | Free
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

ext-name

Visual Studio Marketplace Version Made with reactive-vscode

Configurations

No data

Commands

Command Title
pubinfoAi.openChat Pubinfo AI: 打开聊天面板

Sponsors

License

MIT License © 2022 Anthony Fu

本段落由固定流程自动追加。

文件操作扩展(File Actions)

扩展提供一套可配置文件操作体系,用于在聊天流程或 demoConversation.json 脚本中触发:

支持的原子操作:

  • create: 创建文件,可选 overwrite
  • append: 末尾追加文本,支持不存在时通过 createIfMissing 初始化
  • replaceLine: 通过 match(子串)或 lineNumber(1-based)替换行;找不到可 appendIfMissing
  • ensureDependency: 向 pom.xml 注入依赖(自动插入 <dependencies> 块)
  • ensureJavaController: 确保生成一个 Java 控制器文件

集中定义:src/fileActions.ts 中的 fileActions 预置动作。例如:append-readme、speech-integration。

动态 JSON 扩展

在工作区根目录(非扩展目录)创建 pubinfo.fileActions.json(对象或数组)即可注入自定义动作:

[
  {
    "id": "custom-update-readme",
    "title": "自定义 README 追加",
    "operations": [
      { "type": "append", "path": "README.md", "text": "\n自定义追加内容\n" }
    ]
  }
]

聊天侧 choiceActionMapping 会把 UI 选项映射到动作 ID,可在 chatView.ts 中调整。

demoConversation 中直接触发文件操作

在 apps/src/data/demoConversation.json 的某个对话 response 列表里可加入:

  1. 触发预置/动态动作:
{ "type": "fileAction", "id": "append-readme", "delayMs": 500 }
  1. 直接内联一组原子操作(无需注册):
{
  "type": "fileOps",
  "operations": [
    { "type": "create", "path": "docs/INTEGRATION.md", "content": "# Integration Notes" },
    { "type": "append", "path": "docs/INTEGRATION.md", "text": "\n追加一行" },
    { "type": "replaceLine", "path": "docs/INTEGRATION.md", "match": "# Integration Notes", "newText": "# Integration Notes (Updated)", "appendIfMissing": true }
  ]
}

行替换逻辑单测

test/replaceLine.test.ts 覆盖 applyReplaceLine 的匹配与追加分支,确保变更稳定可回归。

常见问题

  • 未找到文件:append 可配 createIfMissing,replaceLine 可配 appendIfMissing
  • 依赖重复:ensureDependency 会先检测 artifactId 避免重复插入
  • 原始快照:首次修改/新增会记录原始内容,用于后续 diff 展示
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft