Skip to content

Commit 7464c0c

Browse files
July541wz1000
authored andcommitted
Don't refresh HieDb while querying
1 parent 4a761c6 commit 7464c0c

File tree

1 file changed

+0
-35
lines changed
  • plugins/hls-call-hierarchy-plugin/src/Ide/Plugin/CallHierarchy

1 file changed

+0
-35
lines changed

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,6 @@ queryCalls :: (Show a)
261261
-> Action (Maybe [a])
262262
queryCalls item queryFunc makeFunc merge
263263
| Just nfp <- uriToNormalizedFilePath $ toNormalizedUri uri = do
264-
refreshHieDb
265-
266264
ShakeExtras{withHieDb} <- getShakeExtras
267265
maySymbol <- getSymbol nfp
268266
case maySymbol of
@@ -298,36 +296,3 @@ queryCalls item queryFunc makeFunc merge
298296
Nothing -> pure Nothing
299297
Just res -> pure res
300298
Nothing -> pure Nothing
301-
302-
-- Write modified foi files before queries.
303-
refreshHieDb :: Action ()
304-
refreshHieDb = do
305-
fs <- HM.keys . HM.filter (/= OnDisk) <$> getFilesOfInterestUntracked
306-
forM_ fs (\f -> do
307-
tmr <- use_ TypeCheck f
308-
hsc <- hscEnv <$> use_ GhcSession f
309-
(_, masts) <- liftIO $ generateHieAsts hsc tmr
310-
se <- getShakeExtras
311-
case masts of
312-
Nothing -> pure ()
313-
Just asts -> do
314-
source <- getSourceFileSource f
315-
let exports = tcg_exports $ tmrTypechecked tmr
316-
msum = tmrModSummary tmr
317-
liftIO $ writeAndIndexHieFile hsc se msum f exports asts source
318-
pure ()
319-
)
320-
ShakeExtras{hiedbWriter} <- getShakeExtras
321-
liftIO $ atomically $ check $ indexPending hiedbWriter
322-
where
323-
check p = do
324-
v <- readTVar p
325-
if HM.null v then pure () else retry
326-
327-
-- Copy unexport function form `ghcide/src/Development/IDE/Core/Rules.hs`
328-
getSourceFileSource :: NormalizedFilePath -> Action BS.ByteString
329-
getSourceFileSource nfp = do
330-
(_, msource) <- getFileContents nfp
331-
case msource of
332-
Nothing -> liftIO $ BS.readFile (fromNormalizedFilePath nfp)
333-
Just source -> pure $ T.encodeUtf8 source

0 commit comments

Comments
 (0)