Skip to content

Commit 9014f48

Browse files
committed
fix: remove the Indexing progress message when exeption in withHieDb
If any exception was happening in `withHieDb`, the `post` action was never called, leading to a stale `Indexing` message in the client. By using `bracket`, we ensure that the `post` message is called in the event of an exception, cleaning the confusing message in the client. It does not change the well behaving of the indexing (i.e. if it was crashing, it is still crashing), but at least user won't be confused by a stale `Indexing` message.
1 parent 1edb489 commit 9014f48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,8 @@ indexHieFile se mod_summary srcPath !hash hf = do
902902
Just pendingHash -> pendingHash /= hash
903903
unless newerScheduled $ do
904904
pre optProgressStyle
905-
withHieDb (\db -> HieDb.addRefsFromLoaded db targetPath (HieDb.RealFile $ fromNormalizedFilePath srcPath) hash hf')
906-
post
905+
bracket_ (pre optProgressStyle) post $
906+
withHieDb (\db -> HieDb.addRefsFromLoaded db targetPath (HieDb.RealFile $ fromNormalizedFilePath srcPath) hash hf')
907907
where
908908
mod_location = ms_location mod_summary
909909
targetPath = Compat.ml_hie_file mod_location

0 commit comments

Comments
 (0)