File tree 1 file changed +7
-7
lines changed
ghcide/src/Development/IDE/Core
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ import Data.Unique
115
115
import GHC.Fingerprint
116
116
import Data.Coerce
117
117
import Data.Aeson (toJSON )
118
+ import Data.Tuple.Extra (dupe )
118
119
119
120
-- | Given a string buffer, return the string (after preprocessing) and the 'ParsedModule'.
120
121
parseModule
@@ -572,13 +573,12 @@ indexHieFile se mod_summary srcPath hash hf = atomically $ do
572
573
post tok = do
573
574
mdone <- atomically $ do
574
575
-- Remove current element from pending
575
- modifyTVar' indexPending $ HashMap. update (\ pendingHash -> guard (pendingHash /= hash) $> pendingHash) srcPath
576
- pending <- readTVar indexPending
577
- if HashMap. null pending
578
- then Just <$> swapTVar indexCompleted 0
579
- else do
580
- modifyTVar' indexCompleted (+ 1 )
581
- pure Nothing
576
+ pending <- stateTVar indexPending $
577
+ dupe . HashMap. update (\ pendingHash -> guard (pendingHash /= hash) $> pendingHash) srcPath
578
+ modifyTVar' indexCompleted (+ 1 )
579
+ -- If we are done, report and reset completed
580
+ whenMaybe (HashMap. null pending) $
581
+ swapTVar indexCompleted 0
582
582
when (coerce $ ideTesting se) $
583
583
eventer se $ LSP. NotCustomServer $
584
584
LSP. NotificationMessage " 2.0" (LSP. CustomServerMethod " ghcide/reference/ready" ) (toJSON $ fromNormalizedFilePath srcPath)
You can’t perform that action at this time.
0 commit comments