Skip to content

Duplicate pragma warnings fixed #1335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions plugins/default/src/Ide/Plugin/Pragmas.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down