2
2
{-# LANGUAGE GADTs #-}
3
3
{-# LANGUAGE MultiWayIf #-}
4
4
5
-
6
5
-- Mostly taken from "haskell-ide-engine"
7
6
module Development.IDE.Plugin.Completions.Logic (
8
7
CachedCompletions
@@ -66,6 +65,7 @@ import qualified Language.LSP.VFS as VFS
66
65
import Outputable (Outputable )
67
66
import TyCoRep
68
67
68
+
69
69
-- From haskell-ide-engine/hie-plugin-api/Haskell/Ide/Engine/Context.hs
70
70
71
71
-- | A context of a declaration in the program
@@ -403,15 +403,12 @@ cacheDataProducer uri env curMod globalEnv inScopeEnv limports = do
403
403
404
404
(unquals,quals) <- getCompls rdrElts
405
405
406
- -- The list of all importable Modules from all packages
407
- moduleNames <- maybe [] (map showModName) <$> envVisibleModuleNames env
408
406
409
407
return $ CC
410
408
{ allModNamesAsNS = allModNamesAsNS
411
409
, unqualCompls = unquals
412
410
, qualCompls = quals
413
411
, anyQualCompls = []
414
- , importableModules = moduleNames
415
412
}
416
413
417
414
-- | Produces completions from the top level declarations of a module.
@@ -421,7 +418,6 @@ localCompletionsForParsedModule uri pm@ParsedModule{pm_parsed_source = L _ HsMod
421
418
, unqualCompls = compls
422
419
, qualCompls = mempty
423
420
, anyQualCompls = []
424
- , importableModules = mempty
425
421
}
426
422
where
427
423
typeSigIds = Set. fromList
@@ -535,7 +531,7 @@ getCompletions
535
531
-> CompletionsConfig
536
532
-> HM. HashMap T. Text (HashSet. HashSet IdentInfo )
537
533
-> IO [CompletionItem ]
538
- getCompletions plId ideOpts CC {allModNamesAsNS, anyQualCompls, unqualCompls, qualCompls, importableModules }
534
+ getCompletions plId ideOpts CC {allModNamesAsNS, anyQualCompls, unqualCompls, qualCompls}
539
535
maybe_parsed (localBindings, bmapping) prefixInfo caps config moduleExportsMap = do
540
536
let VFS. PosPrefixInfo { fullLine, prefixModule, prefixText } = prefixInfo
541
537
enteredQual = if T. null prefixModule then " " else prefixModule <> " ."
@@ -604,12 +600,11 @@ getCompletions plId ideOpts CC {allModNamesAsNS, anyQualCompls, unqualCompls, qu
604
600
, enteredQual `T.isPrefixOf` label
605
601
]
606
602
607
- filtImportCompls = filtListWith (mkImportCompl enteredQual) importableModules
603
+ filtImportCompls = filtListWith (mkImportCompl enteredQual) $ map fst $ HM. toList moduleExportsMap
608
604
filterModuleExports moduleName = filtListWith $ mkModuleFunctionImport moduleName
609
605
filtKeywordCompls
610
606
| T. null prefixModule = filtListWith mkExtCompl (optKeywords ideOpts)
611
607
| otherwise = []
612
-
613
608
if
614
609
-- TODO: handle multiline imports
615
610
| " import " `T.isPrefixOf` fullLine
0 commit comments