LSP: no-op middleware onDefinition replaces the real definition handler
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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 のクライアントエントリポイントと比較します。関連する provider を apps/lsp/src/service/providers/definitions.ts で確認します。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
- スター
- 652
- フォーク
- 64
- 平均マージ
- 8時間 45分
- マージ済み PR(30日)
- 36
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/quarto のほかの issue
-
VS Code extension: `quarto preview` fails when the file path contains parentheses (path not shell-quoted)対応中かも @Bondrewd-K が 4 日前に担当しました。 オープンbug vscode
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/quarto#1194 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
quarto-dev/quarto#1138 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
quarto-dev/quarto#1137 ·
メンテナーはふだん 1 日以内に返信
-
Add dependabot?再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
quarto-dev/quarto#1135 ·
メンテナーはふだん 1 日以内に返信
-
AceNodeView: programmatic setSelection() marks the cursor dirty, scrolling the document to the front matter対応中かも @kevinushey が 52 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
quarto-dev/quarto#1099 ·
メンテナーはふだん 1 日以内に返信
quarto-dev/quarto の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
chrisparsons83/flexspotff#215 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
vitest-dev/vitest#11633 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信