Skip to content

Commit

Permalink
Add non reversable pragma completion (#1243)
Browse files Browse the repository at this point in the history
* Sort extensions

* Add non-reversable extension completions
  • Loading branch information
Ailrun committed Jan 21, 2021
1 parent be6a6c4 commit 691f2be
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions plugins/default/src/Ide/Plugin/Pragmas.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

-- | Provides code actions to add missing pragmas (whenever GHC suggests to)
module Ide.Plugin.Pragmas
Expand Down Expand Up @@ -115,10 +115,24 @@ findPragma str = concatMap check possiblePragmas

-- | All language pragmas, including the No- variants
allPragmas :: [T.Text]
allPragmas = concat
allPragmas =
concat
[ [name, "No" <> name]
| FlagSpec{flagSpecName = T.pack -> name} <- xFlags
]
<>
-- These pragmas are not part of xFlags as they are not reversable
-- by prepending "No".
[ -- Safe Haskell
"Unsafe"
, "Trustworthy"
, "Safe"

-- Language Version Extensions
, "Haskell98"
, "Haskell2010"
-- Maybe, GHC 2021 after its release?
]

-- ---------------------------------------------------------------------

Expand Down

0 comments on commit 691f2be

Please sign in to comment.