@@ -205,23 +205,23 @@ caRemoveRedundantImports :: Maybe ParsedModule -> Maybe T.Text -> [Diagnostic] -
205
205
caRemoveRedundantImports m contents digs ctxDigs uri
206
206
| Just pm <- m,
207
207
r <- join $ map (\ d -> repeat d `zip` suggestRemoveRedundantImport pm contents d) digs,
208
- not $ null r,
209
208
allEdits <- [ e | (_, (_, edits)) <- r, e <- edits],
210
209
caRemoveAll <- removeAll allEdits,
211
210
ctxEdits <- [ x | x@ (d, _) <- r, d `elem` ctxDigs],
212
- caRemoveCtx <- join $ map (\ (d, (title, tedit)) -> removeSingle title tedit d) ctxEdits
213
- = caRemoveCtx ++ caRemoveAll
211
+ not $ null ctxEdits,
212
+ caRemoveCtx <- map (\ (d, (title, tedit)) -> removeSingle title tedit d) ctxEdits
213
+ = caRemoveCtx ++ [caRemoveAll]
214
214
| otherwise = []
215
215
where
216
- removeSingle title tedit diagnostic = [ CACodeAction CodeAction {.. }] where
216
+ removeSingle title tedit diagnostic = CACodeAction CodeAction {.. } where
217
217
_changes = Just $ Map. singleton uri $ List tedit
218
218
_title = title
219
219
_kind = Just CodeActionQuickFix
220
220
_diagnostics = Just $ List [diagnostic]
221
221
_documentChanges = Nothing
222
222
_edit = Just WorkspaceEdit {.. }
223
223
_command = Nothing
224
- removeAll tedit = [ CACodeAction CodeAction {.. }] where
224
+ removeAll tedit = CACodeAction CodeAction {.. } where
225
225
_changes = Just $ Map. singleton uri $ List tedit
226
226
_title = " Remove all redundant imports"
227
227
_kind = Just CodeActionQuickFix
0 commit comments