From fda9bb2a9dc3221930e849a5335e4da6129fdc68 Mon Sep 17 00:00:00 2001 From: Ishmum Jawad Khan Date: Tue, 9 Feb 2021 15:39:53 +0600 Subject: [PATCH] [bug-fix] duplicate pragma warnings --- plugins/default/src/Ide/Plugin/Pragmas.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/default/src/Ide/Plugin/Pragmas.hs b/plugins/default/src/Ide/Plugin/Pragmas.hs index db08bc5249..8bb11d123d 100644 --- a/plugins/default/src/Ide/Plugin/Pragmas.hs +++ b/plugins/default/src/Ide/Plugin/Pragmas.hs @@ -69,15 +69,14 @@ codeActionProvider _ state _plId docId _ (J.CodeActionContext (J.List diags) _mo let dflags = ms_hspp_opts . pm_mod_summary <$> pm -- Get all potential Pragmas for all diagnostics. pragmas = concatMap (\d -> genPragma dflags (d ^. J.message)) diags - cmds <- mapM mkCodeAction pragmas - return $ Right $ List cmds + cmds = map (J.CACodeAction . snd) . H.toList . H.fromList . map mkTitleCodeActionTuple + return . Right . List $ cmds pragmas where - mkCodeAction pragmaName = do + mkTitleCodeActionTuple pragmaName = do let - codeAction = J.CACodeAction $ J.CodeAction title (Just J.CodeActionQuickFix) (Just (J.List [])) (Just edit) Nothing title = "Add \"" <> pragmaName <> "\"" edit = mkPragmaEdit (docId ^. J.uri) pragmaName - return codeAction + (title, J.CodeAction title (Just J.CodeActionQuickFix) (Just (J.List [])) (Just edit) Nothing) genPragma mDynflags target = [ r | r <- findPragma target, r `notElem` disabled]