8
8
module Ide.Plugin.Pragmas
9
9
(
10
10
descriptor
11
- -- , commands -- TODO: get rid of this
12
11
) where
13
12
14
13
import Control.Lens hiding (List )
@@ -25,7 +24,8 @@ import qualified Language.Haskell.LSP.Types.Lens as J
25
24
import Control.Monad (join )
26
25
import Development.IDE.GHC.Compat
27
26
import 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
29
29
30
30
-- ---------------------------------------------------------------------
31
31
@@ -142,13 +142,13 @@ completion lspFuncs _ide complParams = do
142
142
position = complParams ^. J. position
143
143
contents <- LSP. getVirtualFileFunc lspFuncs $ toNormalizedUri uri
144
144
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
148
147
where
149
148
result (Just pfix)
150
149
| " {-# LANGUAGE" `T.isPrefixOf` VFS. fullLine pfix
151
- = Completions $ List $ map buildCompletion allPragmas
150
+ = Completions $ List $ map buildCompletion
151
+ (Fuzzy. simpleFilter (VFS. prefixText pfix) allPragmas)
152
152
| otherwise
153
153
= Completions $ List []
154
154
result Nothing = Completions $ List []
0 commit comments