Skip to content

Commit

Permalink
Only show progress messages if the computation takes > 0.1s (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmitchell authored Feb 4, 2020
1 parent f06cae0 commit 3d60ddc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ shakeOpen getLspId eventer logger shakeProfileDir (IdeReportProgress reportProgr

lspShakeProgress :: Show a => IO LSP.LspId -> (LSP.FromServerMessage -> IO ()) -> Var (Map a Int) -> IO ()
lspShakeProgress getLspId sendMsg inProgress = do
-- first sleep a bit, so we only show progress messages if it's going to take
-- a "noticable amount of time" (we often expect a thread kill to arrive before the sleep finishes)
sleep 0.1
lspId <- getLspId
u <- ProgressTextToken . T.pack . show . hashUnique <$> newUnique
sendMsg $ LSP.ReqWorkDoneProgressCreate $ LSP.fmServerWorkDoneProgressCreateRequest
Expand Down

0 comments on commit 3d60ddc

Please sign in to comment.