LSP: no-op middleware onDefinition replaces the real definition handler
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript, vscode
调研方向
从 apps/lsp/src/middleware.ts 和 apps/lsp/src/index.ts 开始,将 no-op 定义注册与实际 handler 以及 apps/vscode/src/lsp/client.ts:476 中的客户端入口进行比较。检查 apps/lsp/src/service/providers/definitions.ts 中相关的 provider。完成标准是:code-cell 定义仍使用虚拟文档,并且 prose 中的引用链接和标题会解析到其定义。
由索引模型根据 Issue 内容生成。
描述
Bug
In apps/lsp/src/index.ts, the server registers a real definition handler, and then calls middlewareRegister(connection), which registers a second onDefinition handler that returns null:
// apps/lsp/src/index.ts:186
connection.onDefinition(async (params, token) => {
...
return mdLs?.getDefinition(document, params.position, token);
});
// apps/lsp/src/index.ts:197
middlewareRegister(connection);
// apps/lsp/src/middleware.ts:46
connection.onDefinition(async () => {
return null;
});
In vscode-jsonrpc, registering a request handler replaces the previous one for that method, so the no-op wins. The Quarto LSP's own definition provider (apps/lsp/src/service/providers/definitions.ts) is never called.
Impact
On the client, embeddedGoToDefinitionProvider (apps/vscode/src/lsp/client.ts:476) handles positions inside code cells, and otherwise calls next(...). That falls through to the server, which now always returns null. So in .qmd prose, Go to Definition is broken for:
- reference-style links → their
[ref]: urldefinition - headers (the provider returns the header's own location)
(VS Code's built-in markdown extension may cover some of this for .md, but not for .qmd.)
History
3d4ee144(2023-02-08) added the no-oponDefinitionto enable client middleware for code cells.21e441ed(2023-05-21) consolidated the no-ops intomiddleware.ts.07129a6a(2023-05-22), "integrate quarto lsp w/ mdls lsp", added the real handler inindex.ts. It didn't remove the no-op, which is registered afterwards.
So it looks unintentional: the no-op existed only to advertise the capability, which the real handler now does on its own.
Fix
Remove the onDefinition handler and definitionProvider: true from middleware.ts. index.ts already advertises definitionProvider: true and registers the real handler, and client middleware still intercepts it. Then check that Go to Definition works both inside code cells (via the virtual doc) and on a reference link / header in prose.
It's worth checking the other no-ops in middleware.ts for the same pattern. Right now only definition has a real handler too.
Found during the dependency-upgrade research.
- 主要语言
- TypeScript
- 星标
- 655
- 派生
- 64
- 平均合并
- 20 小时 53 分钟
- 30 天内合并 PR
- 46
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quarto-dev/quarto 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 90/100
quarto-dev/quarto#1138 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
quarto-dev/quarto#1137 ·
维护者通常 1 天内回复
-
Add dependabot?可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
quarto-dev/quarto#1135 ·
维护者通常 1 天内回复
-
vscode
难度 2/5 1-3 小时 新手友好度 72/100
quarto-dev/quarto#934 · 1 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
Run preview and render as tasks with `ShellExecution`, so VS Code quotes arguments for the shell未关闭vscode
难度 4/5 3-5 天 新手友好度 42/100
quarto-dev/quarto#1203 ·
维护者通常 1 天内回复
查看 quarto-dev/quarto 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
farion1231/cc-switch#8829 ·
维护者通常 1 天内回复
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutover未关闭doc-audit enhancement
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100