Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

LSP: no-op middleware onDefinition replaces the real definition handler

オープン 初心者向け
#1,139 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 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]: url definition
  • 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-op onDefinition to enable client middleware for code cells.
  • 21e441ed (2023-05-21) consolidated the no-ops into middleware.ts.
  • 07129a6a (2023-05-22), "integrate quarto lsp w/ mdls lsp", added the real handler in index.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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/quarto のほかの issue

quarto-dev/quarto の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。