[purs ide] Removes Pursuit commands (#3355) · purescript/purescript@3847ae0 · GitHub
Skip to content

Commit 3847ae0

Browse files
authored
[purs ide] Removes Pursuit commands (#3355)
* [purs ide] Removes Pursuit support * Update to LTS 11 * [purs ide] removes pursuit command from PROTOCOL
1 parent df07500 commit 3847ae0

8 files changed

Lines changed: 4 additions & 206 deletions

File tree

‎package.yaml‎

Lines changed: 2 additions & 5 deletions

‎psc-ide/PROTOCOL.md‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -389,52 +389,6 @@ In the Success case you get a list of warnings in the compilers json format.
389389

390390
In the Error case you get the errors in the compilers json format
391391

392-
### Pursuit
393-
The `pursuit` command looks up the packages/completions for a given identifier from Pursuit.
394-
395-
**Params:**
396-
- `query :: String`: With `type: "package"` this should be a module name. With
397-
`type: "completion"` this can be any string to look up.
398-
- `type :: String`: Takes the following values:
399-
- `package`: Looks for packages that contain the given module name.
400-
- `completion` Looks for declarations for the query from Pursuit.
401-
402-
```json
403-
{
404-
"command": "pursuit",
405-
"params": {
406-
"query": "Data.Array",
407-
"type": "package"
408-
}
409-
}
410-
```
411-
412-
**Result:**
413-
414-
`package` returns:
415-
416-
```json
417-
[
418-
{
419-
"module": "Module1.Name",
420-
"package": "purescript-packagename"
421-
}
422-
]
423-
```
424-
425-
`completion` returns:
426-
427-
```json
428-
[
429-
{
430-
"module": "Data.Array",
431-
"identifier": "filter",
432-
"type": "forall a. (a -> Boolean) -> Array a -> Array a",
433-
"package": "purescript-arrays"
434-
}
435-
]
436-
```
437-
438392
### List
439393

440394
#### Loaded Modules

‎src/Language/PureScript/CoreFn/Optimizer.hs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Language.PureScript.CoreFn.Optimizer (optimizeCoreFn) where
22

3-
import Protolude
3+
import Protolude hiding (Type)
44

55
import Data.List (lookup)
66
import Language.PureScript.AST.Literals

‎src/Language/PureScript/Ide.hs‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import Language.PureScript.Ide.Filter
3333
import Language.PureScript.Ide.Imports hiding (Import)
3434
import Language.PureScript.Ide.Matcher
3535
import Language.PureScript.Ide.Prim
36-
import Language.PureScript.Ide.Pursuit
3736
import Language.PureScript.Ide.Rebuild
3837
import Language.PureScript.Ide.SourceFile
3938
import Language.PureScript.Ide.State
@@ -63,10 +62,6 @@ handleCommand c = case c of
6362
findType search filters currentModule
6463
Complete filters matcher currentModule complOptions ->
6564
findCompletions filters matcher currentModule complOptions
66-
Pursuit query Package ->
67-
findPursuitPackages query
68-
Pursuit query Identifier ->
69-
findPursuitCompletions query
7065
List LoadedModules ->
7166
printModules
7267
List AvailableModules ->
@@ -129,16 +124,6 @@ findType search filters currentModule = do
129124
let insertPrim = (++) idePrimDeclarations
130125
pure (CompletionResult (getExactCompletions search filters (insertPrim modules)))
131126

132-
findPursuitCompletions :: MonadIO m =>
133-
PursuitQuery -> m Success
134-
findPursuitCompletions (PursuitQuery q) =
135-
PursuitResult <$> liftIO (searchPursuitForDeclarations q)
136-
137-
findPursuitPackages :: MonadIO m =>
138-
PursuitQuery -> m Success
139-
findPursuitPackages (PursuitQuery q) =
140-
PursuitResult <$> liftIO (findPackagesForModuleIdent q)
141-
142127
printModules :: Ide m => m Success
143128
printModules = ModuleList . map P.runModuleName <$> getLoadedModulenames
144129

‎src/Language/PureScript/Ide/Command.hs‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ data Command
3838
, completeCurrentModule :: Maybe P.ModuleName
3939
, completeOptions :: CompletionOptions
4040
}
41-
| Pursuit
42-
{ pursuitQuery :: PursuitQuery
43-
, pursuitSearchType :: PursuitSearchType
44-
}
4541
| CaseSplit
4642
{ caseSplitLine :: Text
4743
, caseSplitBegin :: Int
@@ -73,7 +69,6 @@ commandName c = case c of
7369
LoadSync{} -> "LoadSync"
7470
Type{} -> "Type"
7571
Complete{} -> "Complete"
76-
Pursuit{} -> "Pursuit"
7772
CaseSplit{} -> "CaseSplit"
7873
AddClause{} -> "AddClause"
7974
FindUsages{} -> "FindUsages"
@@ -146,11 +141,6 @@ instance FromJSON Command where
146141
<*> params .:? "matcher" .!= mempty
147142
<*> (fmap P.moduleNameFromString <$> params .:? "currentModule")
148143
<*> params .:? "options" .!= defaultCompletionOptions
149-
"pursuit" -> do
150-
params <- o .: "params"
151-
Pursuit
152-
<$> params .: "query"
153-
<*> params .: "type"
154144
"caseSplit" -> do
155145
params <- o .: "params"
156146
CaseSplit

‎src/Language/PureScript/Ide/Pursuit.hs‎

Lines changed: 0 additions & 69 deletions
This file was deleted.

‎src/Language/PureScript/Ide/Types.hs‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ data Success =
226226
| TextResult Text
227227
| UsagesResult [P.SourceSpan]
228228
| MultilineTextResult [Text]
229-
| PursuitResult [PursuitResponse]
230229
| ImportList (P.ModuleName, [(P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)])
231230
| ModuleList [ModuleIdent]
232231
| RebuildSuccess P.MultipleErrors
@@ -241,7 +240,6 @@ instance ToJSON Success where
241240
toJSON (TextResult t) = encodeSuccess t
242241
toJSON (UsagesResult ssp) = encodeSuccess ssp
243242
toJSON (MultilineTextResult ts) = encodeSuccess ts
244-
toJSON (PursuitResult resp) = encodeSuccess resp
245243
toJSON (ImportList (moduleName, imports)) = object [ "resultType" .= ("success" :: Text)
246244
, "result" .= object [ "imports" .= map encodeImport imports
247245
, "moduleName" .= P.runModuleName moduleName]]
@@ -265,61 +263,6 @@ encodeImport (P.runModuleName -> mn, importType, map P.runModuleName -> qualifie
265263
, "identifiers" .= (identifierFromDeclarationRef <$> refs)
266264
] ++ map (\x -> "qualifier" .= x) (maybeToList qualifier)
267265

268-
newtype PursuitQuery = PursuitQuery Text
269-
deriving (Show, Eq)
270-
271-
data PursuitSearchType = Package | Identifier
272-
deriving (Show, Eq)
273-
274-
instance FromJSON PursuitSearchType where
275-
parseJSON (String t) = case t of
276-
"package" -> pure Package
277-
"completion" -> pure Identifier
278-
_ -> mzero
279-
parseJSON _ = mzero
280-
281-
instance FromJSON PursuitQuery where
282-
parseJSON o = PursuitQuery <$> parseJSON o
283-
284-
data PursuitResponse =
285-
-- | A Pursuit Response for a module. Consists of the modules name and the
286-
-- package it belongs to
287-
ModuleResponse ModuleIdent Text
288-
-- | A Pursuit Response for a declaration. Consist of the declaration's
289-
-- module, name, package, type summary text
290-
| DeclarationResponse Text ModuleIdent Text (Maybe Text) Text
291-
deriving (Show,Eq)
292-
293-
instance FromJSON PursuitResponse where
294-
parseJSON (Object o) = do
295-
package <- o .: "package"
296-
info <- o .: "info"
297-
(type' :: Text) <- info .: "type"
298-
case type' of
299-
"module" -> do
300-
name <- info .: "module"
301-
pure (ModuleResponse name package)
302-
"declaration" -> do
303-
moduleName <- info .: "module"
304-
ident <- info .: "title"
305-
(text :: Text) <- o .: "text"
306-
typ <- info .:? "typeText"
307-
pure (DeclarationResponse moduleName ident package typ text)
308-
_ -> mzero
309-
parseJSON _ = mzero
310-
311-
instance ToJSON PursuitResponse where
312-
toJSON (ModuleResponse name package) =
313-
object ["module" .= name, "package" .= package]
314-
toJSON (DeclarationResponse module' ident package type' text) =
315-
object
316-
[ "module" .= module'
317-
, "ident" .= ident
318-
, "type" .= type'
319-
, "package" .= package
320-
, "text" .= text
321-
]
322-
323266
-- | Denotes the different namespaces a name in PureScript can reside in.
324267
data IdeNamespace = IdeNSValue | IdeNSType | IdeNSKind
325268
deriving (Show, Eq, Ord, Generic, NFData)

‎stack.yaml‎

Lines changed: 1 addition & 3 deletions

0 commit comments

Comments
 (0)