A vision for consistent static vs dynamic registration
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- haskell
調査の方向性
まず inferServerCapabilities と initialize ハンドラーを読んでください。issue では、現在の登録フローの中心となるものとして、この両方が挙げられています。静的登録と動的登録で capability のデフォルトを共有し、関連するハンドラーを統合する方法を検討し、そのうえで静的登録がクライアントの capabilities に依存できることを確認してください。既存の Options サイドチャネルを使わずに登録モデルが統一されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
At the moment static versus dynamic registration works quite differently.
Specifically:
- When you register a method dynamically, you have to provide the
RegistrationOptions - When you register a method statically, you don't have to provide the
ServerCapability(from https://github.com/haskell/lsp/pull/581)- Instead, we try to infer the appropriate capability. See
inferServerCapabilities - But, this requires a bunch of choices that we can't guess! So we put in a side channel in the form of
Options, which basically lets us pass in things that need to go in the capabilities.
- Instead, we try to infer the appropriate capability. See
I think we could unify these. Specifically, I think we should make the user provide the capability in both cases. That means that we don't need to pass the extra information out-of-band in Options, instead the user can just set things in the capability directly.
Of course, we probably want a way to provide a sensible default capability... but we also want this for the dynamically registered capabilities! So we should try and provide this for everything.
The main complication is that for both static and dynamic registration we may need to register several method handlers under the same capability, and what the capability is will depend on all of them. For example:
textDocument/completionandcompletionItem/resolve. The latter is not registered separately, but is rather indicated by a field in the completion capability.textDocument/semanticTokens/fulland the other semantic tokens methods. Similar.
I think we can do this reasonably nicely by pretending that we can register everything independently, and then merging all the capabilities when we actually do the registration. So for example, we might have a default capability for the textDocument/completion handler that doesn't say it supports resolve, and then a capability for completionItem/resolve that says it supports resolve, and then we merge those together into the final capability that we register. I think this should work for both static and dynamic capabilities.
So I think we want something like this:
-- We might not be able to have these actually instances due to singletons stuff, but morally we want them
instance Semigroup (ServerCapability m)
instance Semigroup (ClientCapability m)
instance Semigroup (RegistrationOptions m)
type StaticRegistration m = (Handler m, ServerCapability m)
type DynamicRegistration m = (Handler m, RegistrationOptions m)
We probably also need the server definition to tell us its static registrations as part of the initialize handler instead of beforehand. This is necessary anyway, since you might need to decide whether to use static or dynamic registration depending on the client's capabilities.
(It would also be nice if we could provide a relatively simple way to have a handler that is either statically or dynamically registered depending on whether the client supports dynamic registration...)
- 主要言語
- Haskell
- スター
- 426
- フォーク
- 107
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
haskell/lsp のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
-
Optimize `instance Eq NormalizedFilepath`?!対応中かも @sjakobi が 381 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
ZuriHac
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
haskell/bytestring#730 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
seal-harness/seal-harness#399 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
fmidue/codeworld-tasks#124 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
reflex-frp/reflex#563 ·