on master help sign in
Handle PackageImporting "this"

"this" means that we only look for the module in the current package, so we only look for a file in that case. Fixes https://github.com/digital-asset/ghcide/issues/37.

commitd859af210238ac98087b356f9a4069cc8e5c6246 authorOlle Fredriksson <fredriksson.olle@gmail.com> dateWed 11 Sep 2019, 21:02 (7 years ago) parentf66c886
1 file changed+6
src/Development/IDE/Import/FindImports.hs+6
src/Development/IDE/Import/FindImports.hs+6
@@ -68,6 +68,12 @@ locateModule
6868 -> m (Either [FileDiagnostic] Import)
6969locateModule dflags exts doesExist modName mbPkgName isSource = do
7070 case mbPkgName of
71+ -- "this" means that we should only look in the current package
72+ Just "this" -> do
73+ mbFile <- locateModuleFile dflags exts doesExist isSource $ unLoc modName
74+ case mbFile of
75+ Nothing -> return $ Left $ notFoundErr dflags modName $ LookupNotFound []
76+ Just file -> return $ Right $ FileImport file
7177 -- if a package name is given we only go look for a package
7278 Just _pkgName -> lookupInPackageDB dflags
7379 Nothing -> do