dsh-tool-lsp/packages/lsp/tool-lsp官方

175.3kStar19.0kFork0Issue752Watching

基于 ctx.lsp 的代码导航工具,提供定义跳转、引用查找、实现跳转和悬停提示四种操作,使用 UTF-16 坐标,适合需要精确代码定位和分析的模型交互场景

机审证据安装命令仓库已核验dsh-plugin Topic许可证READMEAI 百科

此插件是大仓库 deepseek-ai/deepseek-harness 的子包,星数与活跃度统计的是整个仓库。

语言
TypeScript
License
MIT
分支
master
ai-agentscordisdshdsh-plugin

安装

$ dsh plugin --profile web add npm:@deepseek-ai/dsh-tool-lsp

在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程

对话式安装

帮我安装 DeepSeek Harness 插件 deepseek-ai/deepseek-harness/packages/lsp/tool-lsp:先查看仓库 https://github.com/deepseek-ai/deepseek-harness 确认安全性,然后执行安装命令并验证插件加载成功。

把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。

English | 中文

The model-facing lsp tool over ctx.lsp: one read-only tool with four operations for precise code navigation. It owns the model schema, prompt guidance, coordinate conversion, result limits and formatting, and UI presentation; it imports no provider.

Namespace plugin (name / inject / Config / apply, no default export). Injects tools, lsp, and systemPrompt.

The tool

lsp accepts operation (goToDefinition | findReferences | goToImplementation | hover), file_path, line, and character. line and character are positive, one-based UTF-16 cursor coordinates; the tool converts them to the seam's zero-based positions and converts rendered locations back. findReferences includes declarations so impact analysis does not omit the defining site. Provider, language id, workspace root, limits, timeout, initialization, and executable stay outside model input.

The tool requires the workspace root from the session header.cwd, with no fallback: absence fails as LSP_WORKSPACE_REQUIRED before querying. Its canonical result is the complete normalized Service Definition union: { kind: "locations", locations, resolvedWorkspaceUri } or { kind: "hover", hover }; Code Mode can inspect every acquired location and zero-based range directly. Native rendering projects stable, file-grouped path:line:character entries against the provider's canonical workspace URI rather than applying host-platform path rules to the session cwd. A file: URI becomes a workspace-relative path inside that URI or a URI-derived absolute path outside it; malformed and non-file: URIs stay verbatim. Empty locations and null hover are successful no-result responses; malformed provider payloads remain structured errors.

Configuration

KeyDefaultMeaning
maxLocations100Largest number of rendered locations before an omission marker.
maxResultChars16000Largest complete rendered result, including truncation metadata.
timeoutMs60000Tool-call timeout budget, enforced by dsh-tool-call-timeout-policy; covers the complete queued open/query/close lifecycle and is not model-configurable.

Model Experience

System prompt

What the model sees

One system-prompt section (order 112) positions LSP as a precision aid with the following text:

Verbatim guidance
Use search/read for ordinary navigation. Use lsp when textual matches are ambiguous or before a change requires precise definitions, implementations, or references. Positions are one-based line and character (UTF-16) at the cursor; an off-symbol position may return no results. findReferences always includes the declaration.

Token effect

Fixed guidance cost on every request while the plugin is active.

KV Cache effect

Prefix-stable while the plugin scope and guidance text are unchanged; activation or disposal may invalidate reuse from this section.

Tool schema

What the model sees

The model sees the generated lsp schema.

Token effect

Fixed schema cost on every request while enabled; the timeoutMs budget is never sent to the model.

KV Cache effect

Prefix-stable while the visible tool definition and order are unchanged; registration lifecycle or scoped restrictions may invalidate reuse from the first changed schema token.

Results

What the model sees

File-grouped path:line:character location lines or normalized hover text, capped first by maxLocations and then by maxResultChars; omission and truncation markers are included inside the complete character cap. These caps affect only Native/model presentation, not the canonical value. Empty results use distinct No results. / No hover information. lines.

Token effect

Capped per tool result by maxResultChars, with maxLocations additionally bounding navigation item count.

KV Cache effect

Tool results append after the cached request prefix and do not directly invalidate it.

UI presentation

What the model sees

Nothing. The client renders a generic search card — { card: 'generic', kind: 'search', title, locations: [{ path, line }] } — whose args-derived title carries the operation and one-based cursor; follow-along focuses the queried line while the title preserves the column.

Token effect

Zero direct token effect because rendering is client-side only.

KV Cache effect

None; UI presentation is outside the model request.

Known Limitations and Deferred Work

  • UTF-16 cursor coordinates — columns are exact for the protocol but hard for a model to count around non-BMP characters; an off-symbol position may return empty results, so the prompt explains the convention without encouraging broad LSP use (seam Agent Note).
  • No cross-server completeness promise — supported servers may return empty or partial results depending on indexing readiness; the tool promises no completeness across languages or servers.

收录徽章

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/deepseek-ai/deepseek-harness/packages/lsp/tool-lsp)

把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。

返回插件目录
dsh-tool-lsp/packages/lsp/tool-lsp — DeepSeek Harness 插件 | deepseek-plugin.org