|
4 | 4 |
|
5 | 5 | module Development.IDE.Plugin.Completions
|
6 | 6 | ( descriptor
|
7 |
| - , ProduceCompletions(..) |
8 | 7 | , LocalCompletions(..)
|
9 | 8 | , NonLocalCompletions(..)
|
10 | 9 | ) where
|
@@ -49,11 +48,6 @@ descriptor plId = (defaultPluginDescriptor plId)
|
49 | 48 |
|
50 | 49 | produceCompletions :: Rules ()
|
51 | 50 | produceCompletions = do
|
52 |
| - define $ \ProduceCompletions file -> do |
53 |
| - local <- useWithStale LocalCompletions file |
54 |
| - nonLocal <- useWithStale NonLocalCompletions file |
55 |
| - let extract = fmap fst |
56 |
| - return ([], extract local <> extract nonLocal) |
57 | 51 | define $ \LocalCompletions file -> do
|
58 | 52 | let uri = fromNormalizedUri $ normalizedFilePathToUri file
|
59 | 53 | pm <- useWithStale GetParsedModule file
|
@@ -103,16 +97,9 @@ dropListFromImportDecl iDecl = let
|
103 | 97 | in f <$> iDecl
|
104 | 98 |
|
105 | 99 | -- | Produce completions info for a file
|
106 |
| -type instance RuleResult ProduceCompletions = CachedCompletions |
107 | 100 | type instance RuleResult LocalCompletions = CachedCompletions
|
108 | 101 | type instance RuleResult NonLocalCompletions = CachedCompletions
|
109 | 102 |
|
110 |
| -data ProduceCompletions = ProduceCompletions |
111 |
| - deriving (Eq, Show, Typeable, Generic) |
112 |
| -instance Hashable ProduceCompletions |
113 |
| -instance NFData ProduceCompletions |
114 |
| -instance Binary ProduceCompletions |
115 |
| - |
116 | 103 | data LocalCompletions = LocalCompletions
|
117 | 104 | deriving (Eq, Show, Typeable, Generic)
|
118 | 105 | instance Hashable LocalCompletions
|
@@ -142,12 +129,13 @@ getCompletionsLSP plId lsp ide
|
142 | 129 | let npath = toNormalizedFilePath' path
|
143 | 130 | (ideOpts, compls) <- runIdeAction "Completion" (shakeExtras ide) $ do
|
144 | 131 | opts <- liftIO $ getIdeOptionsIO $ shakeExtras ide
|
145 |
| - compls <- useWithStaleFast ProduceCompletions npath |
| 132 | + localCompls <- useWithStaleFast LocalCompletions npath |
| 133 | + nonLocalCompls <- useWithStaleFast NonLocalCompletions npath |
146 | 134 | pm <- useWithStaleFast GetParsedModule npath
|
147 | 135 | binds <- fromMaybe (mempty, zeroMapping) <$> useWithStaleFast GetBindings npath
|
148 |
| - pure (opts, fmap (,pm,binds) compls ) |
| 136 | + pure (opts, fmap (,pm,binds) ((fst <$> localCompls) <> (fst <$> nonLocalCompls))) |
149 | 137 | case compls of
|
150 |
| - Just ((cci', _), parsedMod, bindMap) -> do |
| 138 | + Just (cci', parsedMod, bindMap) -> do |
151 | 139 | pfix <- VFS.getCompletionPrefix position cnts
|
152 | 140 | case (pfix, completionContext) of
|
153 | 141 | (Just (VFS.PosPrefixInfo _ "" _ _), Just CompletionContext { _triggerCharacter = Just "."})
|
|
0 commit comments