88module Ide.Plugin.Pragmas
99 (
1010 descriptor
11- -- , commands -- TODO: get rid of this
1211 ) where
1312
1413import Control.Lens hiding (List )
@@ -25,7 +24,8 @@ import qualified Language.Haskell.LSP.Types.Lens as J
2524import Control.Monad (join )
2625import Development.IDE.GHC.Compat
2726import qualified Language.Haskell.LSP.Core as LSP
28- import qualified Language.Haskell.LSP.VFS as VFS
27+ import qualified Language.Haskell.LSP.VFS as VFS
28+ import qualified Text.Fuzzy as Fuzzy
2929
3030-- ---------------------------------------------------------------------
3131
@@ -142,13 +142,13 @@ completion lspFuncs _ide complParams = do
142142 position = complParams ^. J. position
143143 contents <- LSP. getVirtualFileFunc lspFuncs $ toNormalizedUri uri
144144 fmap Right $ case (contents, uriToFilePath' uri) of
145- (Just cnts, Just _path) -> do
146- pfix <- VFS. getCompletionPrefix position cnts
147- return $ result pfix
145+ (Just cnts, Just _path) ->
146+ result <$> VFS. getCompletionPrefix position cnts
148147 where
149148 result (Just pfix)
150149 | " {-# LANGUAGE" `T.isPrefixOf` VFS. fullLine pfix
151- = Completions $ List $ map buildCompletion allPragmas
150+ = Completions $ List $ map buildCompletion
151+ (Fuzzy. simpleFilter (VFS. prefixText pfix) allPragmas)
152152 | otherwise
153153 = Completions $ List []
154154 result Nothing = Completions $ List []
0 commit comments