Skip to content

Commit d859af2

Browse files
committed
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.
1 parent f66c886 commit d859af2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Development/IDE/Import/FindImports.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ locateModule
6868
-> m (Either [FileDiagnostic] Import)
6969
locateModule 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

0 commit comments

Comments
 (0)