Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit ad0d21f

Browse files
authored
Merge pull request #1295 from wz1000/master
Fix file mapping state when we have a parsed module but not a typechecked module
2 parents cd761a4 + ddb5b90 commit ad0d21f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hie-plugin-api/Haskell/Ide/Engine/ModuleCache.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ cacheModule uri modul = do
225225
let defInfo = CachedInfo mempty mempty mempty mempty rfm return return
226226
return $ case muc of
227227
Just (UriCacheSuccess uc) ->
228-
let newCI = (cachedInfo uc) { revMap = rfm }
228+
let newCI = oldCI { revMap = rfm . revMap oldCI }
229+
-- ^^^^^^^^^^^^
230+
-- We have to retain the old mapping state, since the
231+
-- old TypecheckedModule still contains spans relative to that
232+
oldCI = cachedInfo uc
229233
in uc { cachedPsMod = pm, cachedInfo = newCI }
230234
_ -> UriCache defInfo pm Nothing mempty
231235

0 commit comments

Comments
 (0)