Skip to content

Commit 691f2be

Browse files
authored
Add non reversable pragma completion (#1243)
* Sort extensions * Add non-reversable extension completions
1 parent be6a6c4 commit 691f2be

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

plugins/default/src/Ide/Plugin/Pragmas.hs

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{-# LANGUAGE ViewPatterns #-}
21
{-# LANGUAGE DeriveAnyClass #-}
32
{-# LANGUAGE DeriveGeneric #-}
43
{-# LANGUAGE DuplicateRecordFields #-}
54
{-# LANGUAGE OverloadedStrings #-}
5+
{-# LANGUAGE ViewPatterns #-}
66

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

116116
-- | All language pragmas, including the No- variants
117117
allPragmas :: [T.Text]
118-
allPragmas = concat
118+
allPragmas =
119+
concat
119120
[ [name, "No" <> name]
120121
| FlagSpec{flagSpecName = T.pack -> name} <- xFlags
121122
]
123+
<>
124+
-- These pragmas are not part of xFlags as they are not reversable
125+
-- by prepending "No".
126+
[ -- Safe Haskell
127+
"Unsafe"
128+
, "Trustworthy"
129+
, "Safe"
130+
131+
-- Language Version Extensions
132+
, "Haskell98"
133+
, "Haskell2010"
134+
-- Maybe, GHC 2021 after its release?
135+
]
122136

123137
-- ---------------------------------------------------------------------
124138

0 commit comments

Comments
 (0)