Skip to content

Canonicalize hiedb path before comparing #1800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ import qualified Language.LSP.Server as LSP
import Language.LSP.Types (SMethod (SCustomMethod))
import Language.LSP.VFS
import Module
import System.Directory (canonicalizePath)
import TcRnMonad (tcg_dependent_files)

import Ide.Plugin.Properties (HasProperty, KeyNameProxy, Properties, ToHsType, useProperty)
Expand Down Expand Up @@ -732,10 +733,12 @@ getModIfaceFromDiskAndIndexRule =
hie_loc = ml_hie_file $ ms_location ms
hash <- liftIO $ getFileHash hie_loc
mrow <- liftIO $ HieDb.lookupHieFileFromSource hiedb (fromNormalizedFilePath f)
hie_loc' <- liftIO $ traverse (canonicalizePath . HieDb.hieModuleHieFile) mrow
case mrow of
Just row
| hash == HieDb.modInfoHash (HieDb.hieModInfo row)
, hie_loc == HieDb.hieModuleHieFile row -> do
&& Just hie_loc == hie_loc'
-> do
-- All good, the db has indexed the file
when (coerce $ ideTesting se) $ liftIO $ mRunLspT (lspEnv se) $
LSP.sendNotification (SCustomMethod "ghcide/reference/ready") $
Expand Down