Fix problem with fileModSummary
This commit is contained in:
parent
0ad438461b
commit
8f931eb928
@ -26,6 +26,7 @@ import Language.Haskell.GhcMod.SrcUtils
|
||||
import Language.Haskell.GhcMod.Doc
|
||||
import Language.Haskell.GhcMod.Logging
|
||||
import Language.Haskell.GhcMod.Types
|
||||
import Language.Haskell.GhcMod.FileMapping (fileModSummaryWithMapping)
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- CASE SPLITTING
|
||||
@ -51,7 +52,7 @@ splits file lineNo colNo =
|
||||
crdl <- cradle
|
||||
style <- getStyle
|
||||
dflag <- G.getSessionDynFlags
|
||||
modSum <- Gap.fileModSummary (cradleCurrentDir crdl </> file)
|
||||
modSum <- fileModSummaryWithMapping (cradleCurrentDir crdl </> file)
|
||||
whenFound' opt (getSrcSpanTypeForSplit modSum lineNo colNo) $ \x -> case x of
|
||||
(SplitInfo varName bndLoc (varLoc,varT) _matches) -> do
|
||||
let varName' = showName dflag style varName -- Convert name to string
|
||||
|
@ -3,6 +3,7 @@ module Language.Haskell.GhcMod.FileMapping
|
||||
, loadMappedFiles
|
||||
, unloadMappedFile
|
||||
, mapFile
|
||||
, fileModSummaryWithMapping
|
||||
) where
|
||||
|
||||
import Language.Haskell.GhcMod.Types
|
||||
@ -48,3 +49,11 @@ mkMappedTarget tid taoc _ = return $ mkTarget tid taoc Nothing
|
||||
|
||||
unloadMappedFile :: IOish m => FilePath -> GhcModT m ()
|
||||
unloadMappedFile = (delMMappedFile =<<) . getCanonicalFileNameSafe
|
||||
|
||||
fileModSummaryWithMapping :: (IOish m, GmState m, GhcMonad m, GmEnv m) =>
|
||||
FilePath -> m ModSummary
|
||||
fileModSummaryWithMapping fn = do
|
||||
mmf <- getCanonicalFileNameSafe fn >>= lookupMMappedFile
|
||||
case mmf of
|
||||
Just (RedirectedMapping to) -> fileModSummary to
|
||||
_ -> fileModSummary fn
|
||||
|
@ -27,6 +27,7 @@ import Language.Haskell.GhcMod.Logging (gmLog)
|
||||
import Language.Haskell.GhcMod.Pretty (showDoc)
|
||||
import Language.Haskell.GhcMod.Doc
|
||||
import Language.Haskell.GhcMod.Types
|
||||
import Language.Haskell.GhcMod.FileMapping (fileModSummaryWithMapping)
|
||||
import Outputable (PprStyle)
|
||||
import qualified Type as Ty
|
||||
import qualified HsBinds as Ty
|
||||
@ -76,7 +77,7 @@ sig file lineNo colNo =
|
||||
opt <- options
|
||||
style <- getStyle
|
||||
dflag <- G.getSessionDynFlags
|
||||
modSum <- Gap.fileModSummary file
|
||||
modSum <- fileModSummaryWithMapping file
|
||||
whenFound opt (getSignature modSum lineNo colNo) $ \s ->
|
||||
case s of
|
||||
Signature loc names ty ->
|
||||
@ -345,7 +346,7 @@ refine file lineNo colNo (Expression expr) =
|
||||
opt <- options
|
||||
style <- getStyle
|
||||
dflag <- G.getSessionDynFlags
|
||||
modSum <- Gap.fileModSummary file
|
||||
modSum <- fileModSummaryWithMapping file
|
||||
p <- G.parseModule modSum
|
||||
tcm@TypecheckedModule{tm_typechecked_source = tcs} <- G.typecheckModule p
|
||||
ety <- G.exprType expr
|
||||
@ -422,7 +423,7 @@ auto file lineNo colNo =
|
||||
opt <- options
|
||||
style <- getStyle
|
||||
dflag <- G.getSessionDynFlags
|
||||
modSum <- Gap.fileModSummary file
|
||||
modSum <- fileModSummaryWithMapping file
|
||||
p <- G.parseModule modSum
|
||||
tcm@TypecheckedModule {
|
||||
tm_typechecked_source = tcs
|
||||
|
@ -22,6 +22,7 @@ import Language.Haskell.GhcMod.Logging
|
||||
import Language.Haskell.GhcMod.Monad
|
||||
import Language.Haskell.GhcMod.SrcUtils
|
||||
import Language.Haskell.GhcMod.Types
|
||||
import Language.Haskell.GhcMod.FileMapping (fileModSummaryWithMapping)
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
@ -60,7 +61,7 @@ types file lineNo colNo =
|
||||
runGmlT' [Left file] deferErrors $
|
||||
withContext $ do
|
||||
crdl <- cradle
|
||||
modSum <- Gap.fileModSummary (cradleCurrentDir crdl </> file)
|
||||
modSum <- fileModSummaryWithMapping (cradleCurrentDir crdl </> file)
|
||||
srcSpanTypes <- getSrcSpanType modSum lineNo colNo
|
||||
dflag <- G.getSessionDynFlags
|
||||
st <- getStyle
|
||||
|
Loading…
Reference in New Issue
Block a user