@@ -283,7 +283,7 @@ codeActionProvider plId docId _ context = do
283
283
:: SearchStyle -> [ImportDiagnostic ] -> IdeM [J. CodeAction ]
284
284
importActionsForTerms style importDiagnostics = do
285
285
let searchTerms = map (applySearchStyle style . term) importDiagnostics
286
- searchResults <- mapM Hoogle. searchModules searchTerms
286
+ searchResults <- mapM Hoogle. searchModules' searchTerms
287
287
let importTerms = zip searchResults importDiagnostics
288
288
concat <$> mapM (uncurry (termToActions style)) importTerms
289
289
@@ -311,9 +311,9 @@ codeActionProvider plId docId _ context = do
311
311
-- no import list can be offered, since the function name
312
312
-- may be not the one we expect.
313
313
termToActions
314
- :: SearchStyle -> [ModuleName ] -> ImportDiagnostic -> IdeM [J. CodeAction ]
314
+ :: SearchStyle -> [( ModuleName , SymbolName ) ] -> ImportDiagnostic -> IdeM [J. CodeAction ]
315
315
termToActions style modules impDiagnostic =
316
- concat <$> mapM (importModuleAction style impDiagnostic) modules
316
+ concat <$> mapM (uncurry ( importModuleAction style impDiagnostic) ) modules
317
317
318
318
-- | Creates various import actions for a module and the diagnostic.
319
319
-- Possible import actions depend on the type of the symbol to import.
@@ -322,8 +322,8 @@ codeActionProvider plId docId _ context = do
322
322
-- Thus, it may return zero, one or multiple import actions for a module.
323
323
-- List of import actions does contain no duplicates.
324
324
importModuleAction
325
- :: SearchStyle -> ImportDiagnostic -> ModuleName -> IdeM [J. CodeAction ]
326
- importModuleAction searchStyle impDiagnostic moduleName =
325
+ :: SearchStyle -> ImportDiagnostic -> ModuleName -> SymbolName -> IdeM [J. CodeAction ]
326
+ importModuleAction searchStyle impDiagnostic moduleName symbolTerm =
327
327
catMaybes <$> sequenceA codeActions
328
328
where
329
329
importListActions :: [IdeM (Maybe J. CodeAction )]
@@ -339,23 +339,23 @@ codeActionProvider plId docId _ context = do
339
339
-- import only this function
340
340
Symbol
341
341
-> [ mkImportAction moduleName impDiagnostic . Just . Only
342
- <$> symName (term impDiagnostic)
342
+ <$> symName symbolTerm
343
343
]
344
344
-- Constructors can be imported in two ways, either all
345
345
-- constructors of a type or only a subset.
346
346
-- We can only import a single constructor at a time though.
347
347
Constructor
348
348
-> [ mkImportAction moduleName impDiagnostic . Just . AllOf
349
- <$> datatypeName (term impDiagnostic)
349
+ <$> datatypeName symbolTerm
350
350
, (\ dt sym -> mkImportAction moduleName impDiagnostic . Just
351
351
$ OneOf dt sym)
352
- <$> datatypeName (term impDiagnostic)
353
- <*> symName (term impDiagnostic)
352
+ <$> datatypeName symbolTerm
353
+ <*> symName symbolTerm
354
354
]
355
355
-- If we are looking for a type, import it as just a symbol
356
356
Type
357
357
-> [ mkImportAction moduleName impDiagnostic . Just . Only
358
- <$> symName (term impDiagnostic) ]
358
+ <$> symName symbolTerm ]
359
359
360
360
-- | All code actions that may be available
361
361
-- Currently, omits all
0 commit comments