Skip to content

Commit 277faef

Browse files
committed
Remove manual parsing in getCompletions
1 parent ee25e2c commit 277faef

File tree

1 file changed

+0
-16
lines changed
  • ghcide/src/Development/IDE/Plugin/Completions

1 file changed

+0
-16
lines changed

ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

-16
Original file line numberDiff line numberDiff line change
@@ -579,23 +579,11 @@ getCompletions
579579
| Just (ImportHidingContext moduleName) <- maybeContext
580580
= moduleImportListCompletions moduleName
581581

582-
-- TODO: Is manual parsing ever needed or is context always present for module?
583-
-- If possible only keep the above.
584-
| "import " `T.isPrefixOf` fullLine
585-
, Just moduleName <- getModuleName fullLine
586-
, "(" `T.isInfixOf` fullLine
587-
= moduleImportListCompletions $ T.unpack moduleName
588-
589582
-- ------------------------------------------------------------------------
590583
-- IMPORT MODULENAM|
591584
| Just (ImportContext _moduleName) <- maybeContext
592585
= filtImportCompls
593586

594-
-- TODO: Can we avoid this manual parsing?
595-
-- If possible only keep the above.
596-
| "import " `T.isPrefixOf` fullLine
597-
= filtImportCompls
598-
599587
-- ------------------------------------------------------------------------
600588
-- {-# LA| #-}
601589
-- we leave this condition here to avoid duplications and return empty list
@@ -707,10 +695,6 @@ getCompletions
707695
funs = map (show . name) $ HashSet.toList funcs
708696
in filterModuleExports moduleName $ map T.pack funs
709697

710-
-- manually parse in case we don't have completion context ("import [qualified ]ModuleName")
711-
getModuleName :: T.Text -> Maybe T.Text
712-
getModuleName line = filter (/= "qualified") (T.words line) !? 1
713-
714698
filtImportCompls :: [Scored CompletionItem]
715699
filtImportCompls = filtListWith (mkImportCompl enteredQual) importableModules
716700

0 commit comments

Comments
 (0)