File tree 3 files changed +16
-3
lines changed
src/Development/IDE/Spans 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ jobs:
135
135
- if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
136
136
name : untar
137
137
run : |
138
+ mkdir -p ~/.cabal
138
139
tar xzf workspace.tar.gz
139
140
tar xzf cabal.tar.gz --directory ~/.cabal
140
141
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ cabal-version: 2.4
2
2
build-type : Simple
3
3
category : Development
4
4
name : ghcide
5
- version : 1.4.0.0
5
+ version : 1.4.0.1
6
6
license : Apache-2.0
7
7
license-file : LICENSE
8
8
author : Digital Asset and Ghcide contributors
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ import Data.List (isSuffixOf)
57
57
import Data.List.Extra (dropEnd1 , nubOrd )
58
58
59
59
import HieDb hiding (pointCommand )
60
+ import System.Directory (doesFileExist )
60
61
61
62
-- | Gives a Uri for the module, given the .hie file location and the the module info
62
63
-- The Bool denotes if it is a boot module
@@ -312,8 +313,19 @@ nameToLocation hiedb lookupModule name = runMaybeT $
312
313
case nameSrcSpan name of
313
314
sp@ (OldRealSrcSpan rsp)
314
315
-- Lookup in the db if we got a location in a boot file
315
- | not $ " boot" `isSuffixOf` unpackFS (srcSpanFile rsp) -> MaybeT $ pure $ fmap pure $ srcSpanToLocation sp
316
- sp -> do
316
+ | fs <- unpackFS (srcSpanFile rsp)
317
+ , not $ " boot" `isSuffixOf` fs
318
+ -> do
319
+ itExists <- liftIO $ doesFileExist fs
320
+ if itExists
321
+ then MaybeT $ pure $ fmap pure $ srcSpanToLocation sp
322
+ -- When reusing .hie files from a cloud cache,
323
+ -- the paths may not match the local file system.
324
+ -- Let's fall back to the hiedb in case it contains local paths
325
+ else fallbackToDb sp
326
+ sp -> fallbackToDb sp
327
+ where
328
+ fallbackToDb sp = do
317
329
guard (sp /= wiredInSrcSpan)
318
330
-- This case usually arises when the definition is in an external package.
319
331
-- In this case the interface files contain garbage source spans
You can’t perform that action at this time.
0 commit comments