dsh-lsp

August 15, 2026 · View on GitHub

DeepSeek Harness(DSH)LSP 插件:模型工具面 + 共享服务

  • 注册三个只读模型工具:lsp_goto_definition / lsp_find_references / lsp_diagnostics
  • provide('lsp') 服务:多语言 LSP 客户端(懒 spawn、生命周期随插件) ——TUI 展示桥(如 @huiliyi37/dsh-tianshu-tui)探测到该服务时消费它, 与模型工具面共享同一 LSP server 集,不双份 spawn;未装配本插件时 TUI 回落内置桥。

安装

npx -y @deepseek-ai/dsh plugin --profile tui add github:omdsh-dev/dsh-lsp
npx -y @deepseek-ai/dsh --profile tui

或手工在 profile 的 cordis.patch.yml 追加:

- insert:
    - id: lsp
      name: '@deepseek-ai/dsh-lsp'

工具

工具参数返回
lsp_goto_definitionfile_path / line(1-based)/ column(0-based)定义位置列表 path:line:col
lsp_find_references同上引用位置列表
lsp_diagnosticsfile_path诊断列表(severity / 行列 / message)

三个工具均带 presentCall(generic 卡片标题),TUI 工具卡零接线消费。

语言支持

扩展名server可用性
.ts .tsx .js .jsx .mjs .cjstypescript-language-server(经 npx -y默认可用(首次触发时下载)
.py .pyipyright-langserverPATH 探测
.gogoplsPATH 探测
.rsrust-analyzerPATH 探测
.c .h .cpp .cc .cxx .hpp .hhclangdPATH 探测
.javajdtlsPATH 探测

server 未安装时对应文件返回空结果(不报错);拉取超时(默认 2s,可配 timeoutMs)静默返回空。

配置

缺省说明
enabledtrue主开关
timeoutMs2000单次调用超时(毫秒)
cwdprocess.cwd()LSP server rootUri 基准

服务接口(ctx.get('lsp')

interface LspService {
  getDiagnostics(filePath: string, timeoutMs?: number): Promise<LspDiagnostic[]>
  gotoDefinition(filePath: string, line: number, character: number): Promise<LspLocation[]>
  findReferences(filePath: string, line: number, character: number): Promise<LspLocation[]>
  changeFile(filePath: string): void
  isAvailable(): boolean
  dispose(): void
}

开发

npm install
npm run typecheck
npm test
npm run build

来源

LSP 客户端核心(rpc / manager / multi-manager / server-registry)移植自 天枢 Tianshu src/lsp/ (Apache-2.0 上游;本包按 MIT 分发,上游许可声明见 NOTICE)。