Skip to content

Commit 405a55f

Browse files
committed
Canonicalize hiedb path before comparing
Path comparisons are not accurate if non canonical
1 parent ef0e9fd commit 405a55f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ghcide/src/Development/IDE/Core/Rules.hs

+4-1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ import qualified Language.LSP.Server as LSP
137137
import Language.LSP.Types (SMethod (SCustomMethod))
138138
import Language.LSP.VFS
139139
import Module
140+
import System.Directory (canonicalizePath)
140141
import TcRnMonad (tcg_dependent_files)
141142

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

0 commit comments

Comments
 (0)