`withProgress Cancellable` doesn't seem to work?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia leggendo l’implementazione di withProgress e l’handler integrato per "window/workDoneProgress/cancel" nel codice sorgente di lsp. Riproduci il problema con l’esempio onExecuteCommand fornito, quindi verifica se l’attesa del lavoro asincrono impedisce la gestione della cancellazione. Il lavoro è completato quando la cancellazione interrompe il lavoro simulato ed evita l’errore di assenza di handler.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- Haskell
- Stelle
- 426
- Fork
- 107
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di haskell/lsp
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
-
Optimize `instance Eq NormalizedFilepath`?!Forse già presa @sjakobi l’ha presa 381 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Improve snippet sanitizationApertaZuriHac
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
haskell/bytestring#730 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
seal-harness/seal-harness#399 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
fmidue/codeworld-tasks#124 ·
-
allow haskell-src-exts-1.24Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
reflex-frp/reflex#563 ·