Skip to content

Commit

Permalink
fix progress
Browse files Browse the repository at this point in the history
  • Loading branch information
wz1000 committed Jan 17, 2021
1 parent 4c044b4 commit 4b85e2a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ghcide/src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ import Data.Unique
import GHC.Fingerprint
import Data.Coerce
import Data.Aeson (toJSON)
import Data.Tuple.Extra (dupe)

-- | Given a string buffer, return the string (after preprocessing) and the 'ParsedModule'.
parseModule
Expand Down Expand Up @@ -572,13 +573,12 @@ indexHieFile se mod_summary srcPath hash hf = atomically $ do
post tok = do
mdone <- atomically $ do
-- Remove current element from pending
modifyTVar' indexPending $ HashMap.update (\pendingHash -> guard (pendingHash /= hash) $> pendingHash) srcPath
pending <- readTVar indexPending
if HashMap.null pending
then Just <$> swapTVar indexCompleted 0
else do
modifyTVar' indexCompleted (+1)
pure Nothing
pending <- stateTVar indexPending $
dupe . HashMap.update (\pendingHash -> guard (pendingHash /= hash) $> pendingHash) srcPath
modifyTVar' indexCompleted (+1)
-- If we are done, report and reset completed
whenMaybe (HashMap.null pending) $
swapTVar indexCompleted 0
when (coerce $ ideTesting se) $
eventer se $ LSP.NotCustomServer $
LSP.NotificationMessage "2.0" (LSP.CustomServerMethod "ghcide/reference/ready") (toJSON $ fromNormalizedFilePath srcPath)
Expand Down

0 comments on commit 4b85e2a

Please sign in to comment.