Skip to content

Commit c2f5bc1

Browse files
committed
Import Path Fix
1 parent e8bcff5 commit c2f5bc1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

plugins/default/src/Ide/Plugin/Eval/CodeLens.hs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import Development.IDE.Core.RuleTypes (
8080
GhcSessionDeps (..),
8181
)
8282
import Development.IDE.GHC.Compat (HscEnv)
83+
import Development.IDE.GHC.Util (moduleImportPath)
8384
import DynamicLoading (initializePlugins)
8485
import GHC (
8586
ExecOptions (
@@ -369,11 +370,18 @@ runEvalCmd lsp state EvalParams{..} =
369370
-- Install the module pragmas and options
370371
df <- liftIO $ setupDynFlagsForGHCiLike env $ ms_hspp_opts ms
371372

372-
-- Restore the cradle import paths
373-
let impPaths =
374-
fromMaybe (importPaths df) $ envImportPaths session
373+
-- Desperately looking for an import path
374+
let impPaths0 = importPaths df
375+
impPaths1 = envImportPaths session
376+
impPaths2 = (: []) <$> moduleImportPath nfp modName
377+
impPaths = fromMaybe impPaths0 $ impPaths1 <> impPaths2
378+
dbg "importPaths0" impPaths0
379+
dbg "importPaths1" impPaths1
380+
dbg "importPaths2" impPaths2
375381
dbg "importPaths" impPaths
382+
-- Restore the cradle import paths
376383
df <- return df{importPaths = impPaths}
384+
377385
-- Set the modified flags in the session
378386
_lp <- setSessionDynFlags df
379387

0 commit comments

Comments
 (0)