@@ -7,8 +7,6 @@ module Development.IDE.Core.Completions (
7
7
) where
8
8
9
9
import Control.Applicative
10
- import Data.Aeson
11
- import Data.Aeson.Types
12
10
import Data.Char (isSpace )
13
11
import Data.Generics
14
12
import Data.List as List hiding (stripPrefix )
@@ -18,7 +16,6 @@ import qualified Data.Text as T
18
16
import qualified Text.Fuzzy as Fuzzy
19
17
20
18
import GHC
21
- import Module
22
19
import HscTypes
23
20
import Name
24
21
import RdrName
@@ -39,43 +36,6 @@ import Development.IDE.Spans.Documentation
39
36
40
37
-- From haskell-ide-engine/src/Haskell/Ide/Engine/Support/HieExtras.hs
41
38
42
- data NameDetails
43
- = NameDetails Module OccName
44
- deriving (Eq )
45
-
46
- nsJSON :: NameSpace -> Value
47
- nsJSON ns
48
- | isVarNameSpace ns = String " v"
49
- | isDataConNameSpace ns = String " c"
50
- | isTcClsNameSpace ns = String " t"
51
- | isTvNameSpace ns = String " z"
52
- | otherwise = error " namespace not recognized"
53
-
54
- parseNs :: Value -> Parser NameSpace
55
- parseNs (String " v" ) = pure Name. varName
56
- parseNs (String " c" ) = pure dataName
57
- parseNs (String " t" ) = pure tcClsName
58
- parseNs (String " z" ) = pure tvName
59
- parseNs _ = mempty
60
-
61
- instance FromJSON NameDetails where
62
- parseJSON v@ (Array _)
63
- = do
64
- [modname,modid,namesp,occname] <- parseJSON v
65
- mn <- parseJSON modname
66
- mid <- parseJSON modid
67
- ns <- parseNs namesp
68
- occn <- parseJSON occname
69
- pure $ NameDetails (mkModule (stringToUnitId mid) (mkModuleName mn)) (mkOccName ns occn)
70
- parseJSON _ = mempty
71
- instance ToJSON NameDetails where
72
- toJSON (NameDetails mdl occ) = toJSON [toJSON mname,toJSON mid,nsJSON ns,toJSON occs]
73
- where
74
- mname = moduleNameString $ moduleName mdl
75
- mid = unitIdString $ moduleUnitId mdl
76
- ns = occNameSpace occ
77
- occs = occNameString occ
78
-
79
39
safeTyThingId :: TyThing -> Maybe Id
80
40
safeTyThingId (AnId i) = Just i
81
41
safeTyThingId (AConLike (RealDataCon dc)) = Just $ dataConWrapId dc
@@ -175,9 +135,6 @@ getCContext pos pm
175
135
| otherwise = Nothing
176
136
importInline _ _ = Nothing
177
137
178
- type CompItemResolveData
179
- = Maybe NameDetails
180
-
181
138
occNameToComKind :: OccName -> CompletionItemKind
182
139
occNameToComKind oc
183
140
| isVarOcc oc = CiFunction
@@ -190,9 +147,8 @@ mkCompl CI{origName,importedFrom,thingType,label,isInfix,docs} =
190
147
CompletionItem label kind (Just $ maybe " " (<> " \n " ) typeText <> importedFrom)
191
148
(Just $ CompletionDocMarkup $ MarkupContent MkMarkdown $ T. intercalate sectionSeparator docs)
192
149
Nothing Nothing Nothing Nothing (Just insertText) (Just Snippet )
193
- Nothing Nothing Nothing Nothing resolveData
150
+ Nothing Nothing Nothing Nothing Nothing
194
151
where kind = Just $ occNameToComKind $ occName origName
195
- resolveData = Just (toJSON nameDets)
196
152
insertText = case isInfix of
197
153
Nothing -> case getArgText <$> thingType of
198
154
Nothing -> label
@@ -203,11 +159,6 @@ mkCompl CI{origName,importedFrom,thingType,label,isInfix,docs} =
203
159
typeText
204
160
| Just t <- thingType = Just . stripForall $ T. pack (showGhc t)
205
161
| otherwise = Nothing
206
- nameDets =
207
- case (thingType, nameModule_maybe origName) of
208
- (Just _,_) -> Nothing
209
- (Nothing , Nothing ) -> Nothing
210
- (Nothing , Just mdl) -> Just (NameDetails mdl (nameOccName origName))
211
162
212
163
stripForall :: T. Text -> T. Text
213
164
stripForall t
@@ -242,9 +193,7 @@ mkModCompl :: T.Text -> CompletionItem
242
193
mkModCompl label =
243
194
CompletionItem label (Just CiModule ) Nothing
244
195
Nothing Nothing Nothing Nothing Nothing Nothing Nothing
245
- Nothing Nothing Nothing Nothing (Just $ toJSON resolveData)
246
- where resolveData :: CompItemResolveData
247
- resolveData = Nothing
196
+ Nothing Nothing Nothing Nothing Nothing
248
197
249
198
mkImportCompl :: T. Text -> T. Text -> CompletionItem
250
199
mkImportCompl enteredQual label =
0 commit comments