Skip to content

feat(host-internal): 多语言 LSP 接入与 get_diagnostics 动态工具描述#71

Merged
N123999 merged 9 commits into
mainfrom
feat/lsp-multi-language
Jun 5, 2026
Merged

feat(host-internal): 多语言 LSP 接入与 get_diagnostics 动态工具描述#71
N123999 merged 9 commits into
mainfrom
feat/lsp-multi-language

Conversation

@N123999

@N123999 N123999 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 将 LSP 从单 TS/JS MVP 扩展为多 provider 架构(LspOrchestrator + LspProviderSession),按文件后缀路由至 typescript-language-server、Pyright、gopls、rust-analyzer、clangd、jdtls、OmniSharp。
  • Desktop 安装支持 npm / go / rustup 引导;clangd、jdtls、OmniSharp 提供 PATH 发现与手动/平台安装指引。
  • get_diagnostics 工具描述按当前 probe 就绪的 provider 动态生成,避免模型误以为未安装语言可用;不写 HTML/CSS 负向提示。
  • HTML/CSS 未纳入本 PR;边界文档已更新。

Test plan

  • npm run build
  • npm --prefix packages/host-internal run test:lsp(含 orchestrator、ready-providers、install)
  • agent-core LSP 契约测试(constants、host-tools-lsp-ask)
  • npm --prefix apps/desktop run test:host
  • Desktop 手动:Agents 页仅就绪 server 出现在模型工具描述中
  • eval:compare

N123999 added 8 commits June 5, 2026 08:19
扩展 provider 目录与按文件后缀路由,并将 PATH 解析抽象为通用 resolveCommandOnPath;运行时仍仅探测 TypeScript 语言服务器。
新增 LspProviderSession 与 LspOrchestrator,LspService 改为门面;TypeScript 端到端行为保持不变。
注册 pyright、gopls PATH 解析与 install 模块(npm/go),Desktop 安装命令改用统一 installLspProvider。
注册 rust-analyzer、clangd PATH 解析,扩展 languageId 映射;clangd 安装仍走平台包管理器指引。
jdtls 使用 Java 21+ 自定义启动器与工作区 data 目录;OmniSharp 支持 PATH 与 dotnet+dll 回退。
扩展 LSP 支持后缀与工具描述,get_diagnostics 与写后 append 按后缀自动路由到已安装语言服务器。
更新 agent-core/host 边界说明;Desktop LSP 快照支持 installKind,仅对 npm/go/rustup 显示一键安装。
合并工具定义时传入 probe 后就绪的 provider 列表,避免模型误以为未安装语言也可用
@N123999

N123999 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 00f8d3e. Configure here.


const resolvedPath = resolvedPathFromWriteRequest(lsp.workspaceRoot, request);
if (!resolvedPath || !isTypescriptJavascriptPath(resolvedPath)) {
if (!resolvedPath || !isLspSupportedPath(resolvedPath)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write append masks missing server

Medium Severity

After a successful write, post-edit LSP append now runs for every in-scope extension, not only TypeScript/JavaScript. When the matching language server was never probed as ready, getDiagnosticsForPath fails, and the broad catch still appends “diagnostics pending or timed out,” which misleads the model about a missing server versus a slow analysis.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 00f8d3e. Configure here.

hasReadyProviderForPath 过滤未 probe 就绪的后缀;catch 仅对 LspTimeoutError 追加 pending 文案,避免无 server 被误判为慢分析。
@N123999 N123999 merged commit 0864933 into main Jun 5, 2026
@N123999 N123999 deleted the feat/lsp-multi-language branch June 5, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant