File tree 1 file changed +12
-2
lines changed
ghcide/src/Development/IDE/Spans
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -389,9 +389,19 @@ defRowToLocation lookupModule (row:.info) = do
389
389
let start = Position (fromIntegral $ defSLine row - 1 ) (fromIntegral $ defSCol row - 1 )
390
390
end = Position (fromIntegral $ defELine row - 1 ) (fromIntegral $ defECol row - 1 )
391
391
range = Range start end
392
+ lookupMod = lookupModule (defSrc row) (modInfoName info) (modInfoUnit info) (modInfoIsBoot info)
392
393
file <- case modInfoSrcFile info of
393
- Just src -> pure $ toUri src
394
- Nothing -> lookupModule (defSrc row) (modInfoName info) (modInfoUnit info) (modInfoIsBoot info)
394
+ Just src -> do
395
+ -- Checking that the file exists covers the case where a
396
+ -- dependency file in .hls is in the database but got deleted
397
+ -- for any reason.
398
+ -- See the function `lookupMod` in Development.IDE.Core.Actions
399
+ -- for where dependency files get created and indexed in hiedb.
400
+ fileExists <- liftIO $ doesFileExist src
401
+ if fileExists
402
+ then pure $ toUri src
403
+ else lookupMod
404
+ Nothing -> lookupMod
395
405
pure $ Location file range
396
406
397
407
toUri :: FilePath -> Uri
You can’t perform that action at this time.
0 commit comments