From 39240d0ac036c5f044d3a33cc8a2503ed10785ff Mon Sep 17 00:00:00 2001 From: Junyoung Clare Jang Date: Thu, 21 Jan 2021 11:33:37 -0500 Subject: [PATCH 1/2] Sort extensions --- plugins/default/src/Ide/Plugin/Pragmas.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/default/src/Ide/Plugin/Pragmas.hs b/plugins/default/src/Ide/Plugin/Pragmas.hs index a74a26ae3b..fa63eff8da 100644 --- a/plugins/default/src/Ide/Plugin/Pragmas.hs +++ b/plugins/default/src/Ide/Plugin/Pragmas.hs @@ -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 From 6617afbe86db6000bfc975c72a0e8191167733d7 Mon Sep 17 00:00:00 2001 From: Junyoung Clare Jang Date: Thu, 21 Jan 2021 11:33:56 -0500 Subject: [PATCH 2/2] Add non-reversable extension completions --- plugins/default/src/Ide/Plugin/Pragmas.hs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/default/src/Ide/Plugin/Pragmas.hs b/plugins/default/src/Ide/Plugin/Pragmas.hs index fa63eff8da..32873a39a8 100644 --- a/plugins/default/src/Ide/Plugin/Pragmas.hs +++ b/plugins/default/src/Ide/Plugin/Pragmas.hs @@ -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? + ] -- ---------------------------------------------------------------------