on master help sign in
Only show progress messages if the computation takes > 0.1s (#392)
commit3d60ddc1edcf09061442788065cb30f87b7459e7 authorNeil Mitchell <ndmitchell@gmail.com> dateTue 4 Feb 2020, 10:02 (7 years ago) parentf06cae0
1 file changed+3
src/Development/IDE/Core/Shake.hs+3
src/Development/IDE/Core/Shake.hs+3
@@ -325,6 +325,9 @@ shakeOpen getLspId eventer logger shakeProfileDir (IdeReportProgress reportProgr
325325
326326lspShakeProgress :: Show a => IO LSP.LspId -> (LSP.FromServerMessage -> IO ()) -> Var (Map a Int) -> IO ()
327327lspShakeProgress getLspId sendMsg inProgress = do
328+ -- first sleep a bit, so we only show progress messages if it's going to take
329+ -- a "noticable amount of time" (we often expect a thread kill to arrive before the sleep finishes)
330+ sleep 0.1
328331 lspId <- getLspId
329332 u <- ProgressTextToken . T.pack . show . hashUnique <$> newUnique
330333 sendMsg $ LSP.ReqWorkDoneProgressCreate $ LSP.fmServerWorkDoneProgressCreateRequest