@@ -172,13 +172,18 @@ completion = completeWord Nothing " \t\n\r" findCompletions
172172 files <- listFiles str
173173 let matches = filter (isPrefixOf str) (names ms)
174174 return $ sortBy sorter $ map simpleCompletion matches ++ files
175− getDeclName :: P.Declaration -> Maybe P.Ident
176− getDeclName (P.ValueDeclaration ident _ _ _) = Just ident
177− getDeclName _ = Nothing
175+ getDeclName :: Maybe [P.DeclarationRef] -> P.Declaration -> Maybe P.Ident
176+ getDeclName Nothing (P.ValueDeclaration ident _ _ _) = Just ident
177+ getDeclName (Just exts) (P.ValueDeclaration ident _ _ _) | isExported = Just ident
178+ where
179+ isExported = flip any exts $ \e -> case e of
180+ P.ValueRef ident' -> ident == ident'
181+ _ -> False
182+ getDeclName _ _ = Nothing
178183 names :: [P.Module] -> [String]
179184 names ms = nub [ show qual
180− | P.Module moduleName ds _ <- ms
181− , ident <- mapMaybe getDeclName ds
185+ | P.Module moduleName ds exts <- ms
186+ , ident <- mapMaybe (getDeclName exts) ds
182187 , qual <- [ P.Qualified Nothing ident
183188 , P.Qualified (Just moduleName) ident]
184189 ]