@@ -5,7 +5,7 @@ import Docs.Search.Declarations (Declarations, mkDeclarations)
55import Docs.Search.DocsJson (DataDeclType (..))
66import Docs.Search.Engine (mkEngineState , packageInfoToString , Result (..))
77import Docs.Search.Engine as Engine
8- import Docs.Search.Extra (listToString , stringToList , (>#>))
8+ import Docs.Search.Extra (stringToList , (>#>))
99import Docs.Search.IndexBuilder as IndexBuilder
1010import Docs.Search.ModuleIndex (ModuleResult , mkPackedModuleIndex , unpackModuleIndex )
1111import Docs.Search.NodeEngine (nodeEngine )
@@ -22,12 +22,12 @@ import Prelude
2222
2323import Data.Array as Array
2424import Data.Identity (Identity (..))
25+ import Data.List as List
2526import Data.Maybe (fromMaybe )
2627import Data.Newtype (un , unwrap , wrap )
2728import Data.Search.Trie as Trie
2829import Data.String (length ) as String
29- import Data.String.Common (split , trim ) as String
30- import Data.Tuple (fst )
30+ import Data.String.Common (split , toLower , trim ) as String
3131import Effect (Effect )
3232import Effect.Aff (launchAff_ )
3333import Effect.Class (liftEffect )
@@ -105,14 +105,13 @@ mkCompleter
105105 -> Effect { completions :: Array String
106106 , matched :: String }
107107mkCompleter index input = do
108- let path = stringToList input
109- let paths =
108+ let path = stringToList $ String .toLower input
109+ paths =
110110 Array .fromFoldable $
111- listToString <$>
112- (fst <$> Trie .query path (unwrap index))
111+ (\result -> unwrap (unwrap result).name) <$>
112+ List .concat ( Trie .queryValues path (unwrap index))
113113
114- pure { completions: paths
115- , matched: input }
114+ pure { completions: paths, matched: input }
116115
117116
118117showResult :: Result -> String
0 commit comments