File tree 1 file changed +7
-5
lines changed
lsp/src/Language/LSP/Server 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -711,6 +711,13 @@ withProgressBase indefinite title clientToken cancellable f = do
711
711
-- for the token var to be filled if we want to use it.
712
712
createToken :: m ()
713
713
createToken = do
714
+ -- See Note [Delayed progress reporting]
715
+ -- This delays the creation of the token as well as the 'begin' message. Creating
716
+ -- the token shouldn't result in any visible action on the client side since
717
+ -- the title/initial percentage aren't given until the 'begin' mesage. However,
718
+ -- it's neater not to create tokens that we won't use, and clients may find it
719
+ -- easier to clean them up if they receive begin/end reports for them.
720
+ liftIO $ threadDelay startDelay
714
721
case clientToken of
715
722
-- See Note [Client- versus server-initiated progress]
716
723
-- Client-initiated progress
@@ -752,11 +759,6 @@ withProgressBase indefinite title clientToken cancellable f = do
752
759
Cancellable -> Just True
753
760
NotCancellable -> Just False
754
761
begin t = do
755
- -- See Note [Delayed progress reporting]
756
- -- This delays the 'begin' message but not the creation of the token. Creating
757
- -- the token shouldn't result in any visible action on the client side since
758
- -- the title/initial percentage aren't given until the 'begin' mesage
759
- liftIO $ threadDelay startDelay
760
762
(ProgressAmount pct msg) <- liftIO $ atomically $ takeTMVar reportVar
761
763
sendProgressReport t $ WorkDoneProgressBegin L. AString title cancellable' msg pct
762
764
update t =
You can’t perform that action at this time.
0 commit comments