Skip to content

Commit b43ed7c

Browse files
committed
Get rid of constant delay
1 parent 25b8201 commit b43ed7c

File tree

1 file changed

+7
-2
lines changed
  • plugins/hls-call-hierarchy-plugin/src/Ide/Plugin/CallHierarchy

1 file changed

+7
-2
lines changed

plugins/hls-call-hierarchy-plugin/src/Ide/Plugin/CallHierarchy/Internal.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module Ide.Plugin.CallHierarchy.Internal (
1212
, outgoingCalls
1313
) where
1414

15-
import Control.Concurrent
1615
import Control.Lens ((^.))
1716
import Control.Monad.Extra
1817
import Control.Monad.IO.Class
@@ -31,6 +30,7 @@ import Development.IDE.Core.Compile
3130
import Development.IDE.Core.Shake
3231
import Development.IDE.GHC.Compat as Compat
3332
import Development.IDE.Spans.AtPoint
33+
import GHC.Conc.Sync
3434
import HieDb (Symbol (Symbol))
3535
import qualified Ide.Plugin.CallHierarchy.Query as Q
3636
import Ide.Plugin.CallHierarchy.Types
@@ -318,7 +318,12 @@ refreshHieDb = do
318318
liftIO $ writeAndIndexHieFile hsc se msum f exports asts source
319319
pure ()
320320
)
321-
liftIO $ threadDelay 100000 -- delay 0.1 sec to make more exact results.
321+
ShakeExtras{hiedbWriter} <- getShakeExtras
322+
liftIO $ atomically $ check $ indexPending hiedbWriter
323+
where
324+
check p = do
325+
v <- readTVar p
326+
if HM.null v then pure () else retry
322327

323328
-- Copy unexport function form `ghcide/src/Development/IDE/Core/Rules.hs`
324329
getSourceFileSource :: NormalizedFilePath -> Action BS.ByteString

0 commit comments

Comments
 (0)