`withProgress Cancellable` doesn't seem to work?
まだ誰も着手していません。
評価
調査の方向性
まず、lsp ソースにある withProgress の実装と、"window/workDoneProgress/cancel" 用の組み込みハンドラーを読みます。提供された onExecuteCommand の例で問題を再現し、その後、非同期処理を待機するとキャンセル処理が妨げられるかどうかを追跡します。キャンセルによってシミュレートされた処理が停止し、ハンドラーがないというエラーが発生しなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Hello,
I've just started using this package recently, so possibly I am using it incorrectly, or misunderstand something. The issue is that I can't seem to get withProgress to work correctly when an action is cancelled. To test it, I've made a server function like this:
onExecuteCommand :: LSP.ExecuteCommandParams -> M () -> M ()
onExecuteCommand _ps k =
Srv.withProgress "PROG" Srv.Cancellable (go 0)
where
go n advance =
if n < 100
then do
liftIO (threadDelay (1 * 10^(6::Int)))
_ <- advance (Srv.ProgressAmount (Just n)
(Just (Text.pack ("THING: " ++ show n))))
go (n+5) advance
else k
`catch` \(_ :: Srv.ProgressCancelledException) -> do
lspShow Info "Cancelled"
Basically the idea is that we sleep for a second a bunch of times to simulate work. This works great as long as you don't cancel the action. If the action is cancelled, the work seems to continue executing, and when it is finished I get this error:
LSP: no handler for: "window/workDoneProgress/cancel"
Looking at lsp's source code, it looks like there is a built-in handler for this, which makes sense. However, this handler never seems to fire.
I wonder if the problem is that in the implementation of withProgress, we fork off the work with async, but then we wait for it straight away, so we are blocked and can't handle the cancel message from the client?
Thoughts?
- 主要言語
- 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 が 382 日前に担当しました。 オープン
難易度 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 ·