Skip to content

Commit 8f5606b

Browse files
committed
Civilized indexing progress reporting
1 parent 6d1f1a5 commit 8f5606b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

+3-5
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ indexHieFile se mod_summary srcPath hash hf = atomically $ do
545545
_ <- LSP.sendRequest LSP.SWindowWorkDoneProgressCreate (LSP.WorkDoneProgressCreateParams u) (const $ pure ())
546546
LSP.sendNotification LSP.SProgress $ LSP.ProgressParams u $
547547
LSP.Begin $ LSP.WorkDoneProgressBeginParams
548-
{ _title = "Indexing references from:"
548+
{ _title = "Indexing references"
549549
, _cancellable = Nothing
550550
, _message = Nothing
551551
, _percentage = Nothing
@@ -557,14 +557,12 @@ indexHieFile se mod_summary srcPath hash hf = atomically $ do
557557
remaining <- HashMap.size <$> readTVar indexPending
558558
pure (done, remaining)
559559

560-
let progress = " (" <> T.pack (show done) <> "/" <> T.pack (show $ done + remaining) <> ")..."
561-
562560
whenJust (lspEnv se) $ \env -> whenJust tok $ \tok -> LSP.runLspT env $
563561
LSP.sendNotification LSP.SProgress $ LSP.ProgressParams tok $
564562
LSP.Report $ LSP.WorkDoneProgressReportParams
565563
{ _cancellable = Nothing
566-
, _message = Just $ T.pack (fromNormalizedFilePath srcPath) <> progress
567-
, _percentage = Nothing
564+
, _message = Nothing
565+
, _percentage = Just (100 * fromIntegral done / fromIntegral (done + remaining) )
568566
}
569567

570568
-- Report the progress once we are done indexing this file

0 commit comments

Comments
 (0)