Skip to content

Commit 2896906

Browse files
authored
Fix the guard target (#876)
1 parent 71c88dc commit 2896906

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Development/IDE/Plugin/CodeAction.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,23 +205,23 @@ caRemoveRedundantImports :: Maybe ParsedModule -> Maybe T.Text -> [Diagnostic] -
205205
caRemoveRedundantImports m contents digs ctxDigs uri
206206
| Just pm <- m,
207207
r <- join $ map (\d -> repeat d `zip` suggestRemoveRedundantImport pm contents d) digs,
208-
not $ null r,
209208
allEdits <- [ e | (_, (_, edits)) <- r, e <- edits],
210209
caRemoveAll <- removeAll allEdits,
211210
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]
214214
| otherwise = []
215215
where
216-
removeSingle title tedit diagnostic = [CACodeAction CodeAction{..}] where
216+
removeSingle title tedit diagnostic = CACodeAction CodeAction{..} where
217217
_changes = Just $ Map.singleton uri $ List tedit
218218
_title = title
219219
_kind = Just CodeActionQuickFix
220220
_diagnostics = Just $ List [diagnostic]
221221
_documentChanges = Nothing
222222
_edit = Just WorkspaceEdit{..}
223223
_command = Nothing
224-
removeAll tedit = [CACodeAction CodeAction {..}] where
224+
removeAll tedit = CACodeAction CodeAction {..} where
225225
_changes = Just $ Map.singleton uri $ List tedit
226226
_title = "Remove all redundant imports"
227227
_kind = Just CodeActionQuickFix

0 commit comments

Comments
 (0)