From ddb5b906b779b8af410bdca53341cf04f162166a Mon Sep 17 00:00:00 2001 From: Zubin Duggal Date: Mon, 17 Jun 2019 00:35:24 +0530 Subject: [PATCH] Fix file mapping state when we have a parsed module but not a typechecked module --- hie-plugin-api/Haskell/Ide/Engine/ModuleCache.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hie-plugin-api/Haskell/Ide/Engine/ModuleCache.hs b/hie-plugin-api/Haskell/Ide/Engine/ModuleCache.hs index d23f975de..aa80778d2 100644 --- a/hie-plugin-api/Haskell/Ide/Engine/ModuleCache.hs +++ b/hie-plugin-api/Haskell/Ide/Engine/ModuleCache.hs @@ -225,7 +225,11 @@ cacheModule uri modul = do let defInfo = CachedInfo mempty mempty mempty mempty rfm return return return $ case muc of Just (UriCacheSuccess uc) -> - let newCI = (cachedInfo uc) { revMap = rfm } + let newCI = oldCI { revMap = rfm . revMap oldCI } + -- ^^^^^^^^^^^^ + -- We have to retain the old mapping state, since the + -- old TypecheckedModule still contains spans relative to that + oldCI = cachedInfo uc in uc { cachedPsMod = pm, cachedInfo = newCI } _ -> UriCache defInfo pm Nothing mempty