diff --git a/plugins/hls-gadt-plugin/hls-gadt-plugin.cabal b/plugins/hls-gadt-plugin/hls-gadt-plugin.cabal index 1c2c915c5d..87f5f828ef 100644 --- a/plugins/hls-gadt-plugin/hls-gadt-plugin.cabal +++ b/plugins/hls-gadt-plugin/hls-gadt-plugin.cabal @@ -19,7 +19,15 @@ source-repository head type: git location: https://github.com/haskell/haskell-language-server.git +common warnings + ghc-options: + -Wall + -Wunused-packages + -Wno-name-shadowing + -Wno-unticked-promoted-constructors + library + import: warnings exposed-modules: Ide.Plugin.GADT other-modules: Ide.Plugin.GHC @@ -31,7 +39,6 @@ library , extra , ghc , ghcide == 2.6.0.0 - , ghc-boot-th , ghc-exactprint , hls-plugin-api == 2.6.0.0 , hls-refactor-plugin @@ -40,16 +47,12 @@ library , mtl , text , transformers - , unordered-containers - ghc-options: - -Wall - -Wno-name-shadowing - -Wno-unticked-promoted-constructors default-language: Haskell2010 default-extensions: DataKinds test-suite tests + import: warnings type: exitcode-stdio-1.0 default-language: Haskell2010 hs-source-dirs: test @@ -60,7 +63,4 @@ test-suite tests , filepath , hls-gadt-plugin , hls-test-utils == 2.6.0.0 - , lens - , lsp - , lsp-test , text diff --git a/plugins/hls-gadt-plugin/src/Ide/Plugin/GADT.hs b/plugins/hls-gadt-plugin/src/Ide/Plugin/GADT.hs index 30049035e3..71558e2235 100644 --- a/plugins/hls-gadt-plugin/src/Ide/Plugin/GADT.hs +++ b/plugins/hls-gadt-plugin/src/Ide/Plugin/GADT.hs @@ -57,7 +57,7 @@ toGADTSyntaxCommandId = "GADT.toGADT" -- | A command replaces H98 data decl with GADT decl in place toGADTCommand :: PluginId -> CommandFunction IdeState ToGADTParams toGADTCommand pId@(PluginId pId') state ToGADTParams{..} = withExceptT handleGhcidePluginError $ do - nfp <- withExceptT (GhcidePluginErrors) $ getNormalizedFilePathE uri + nfp <- withExceptT GhcidePluginErrors $ getNormalizedFilePathE uri (decls, exts) <- getInRangeH98DeclsAndExts state range nfp (L ann decl) <- case decls of [d] -> pure d @@ -88,7 +88,7 @@ toGADTCommand pId@(PluginId pId') state ToGADTParams{..} = withExceptT handleGhc codeActionHandler :: PluginMethodHandler IdeState Method_TextDocumentCodeAction codeActionHandler state plId (CodeActionParams _ _ doc range _) = withExceptT handleGhcidePluginError $ do - nfp <- withExceptT (GhcidePluginErrors) $ getNormalizedFilePathE (doc ^. L.uri) + nfp <- withExceptT GhcidePluginErrors $ getNormalizedFilePathE (doc ^. L.uri) (inRangeH98Decls, _) <- getInRangeH98DeclsAndExts state range nfp let actions = map (mkAction . printOutputable . tcdLName . unLoc) inRangeH98Decls pure $ InL actions @@ -138,8 +138,8 @@ handleGhcidePluginError = \case UnexpectedNumberOfDeclarations nums -> do PluginInternalError $ "Expected one declaration but found: " <> T.pack (show nums) FailedToFindDataDeclRange -> - PluginInternalError $ "Unable to get data decl range" + PluginInternalError "Unable to get data decl range" PrettyGadtError errMsg -> - PluginInternalError $ errMsg + PluginInternalError errMsg GhcidePluginErrors errors -> errors diff --git a/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs b/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs index 6d76471a77..27abc088bf 100644 --- a/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs +++ b/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs @@ -5,7 +5,6 @@ {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} {-# OPTIONS_GHC -Wno-overlapping-patterns #-} @@ -13,14 +12,10 @@ module Ide.Plugin.GHC where import Data.Functor ((<&>)) import Data.List.Extra (stripInfix) -import qualified Data.List.NonEmpty as NE import qualified Data.Text as T import Development.IDE import Development.IDE.GHC.Compat import Development.IDE.GHC.Compat.ExactPrint -import Ide.PluginUtils (subRange) -import Language.Haskell.GHC.ExactPrint.Parsers (parseDecl) - import GHC.Parser.Annotation (AddEpAnn (..), Anchor (Anchor), AnchorOperation (MovedAnchor), @@ -30,10 +25,14 @@ import GHC.Parser.Annotation (AddEpAnn (..), EpaLocation (EpaDelta), SrcSpanAnn' (SrcSpanAnn), spanAsAnchor) +import Ide.PluginUtils (subRange) +import Language.Haskell.GHC.ExactPrint (showAst) +import Language.Haskell.GHC.ExactPrint.Parsers (parseDecl) + #if MIN_VERSION_ghc(9,5,0) +import qualified Data.List.NonEmpty as NE import GHC.Parser.Annotation (TokenLocation (..)) #endif -import Language.Haskell.GHC.ExactPrint (showAst) type GP = GhcPass Parsed @@ -229,4 +228,4 @@ noUsed = EpAnnNotUsed pattern UserTyVar' :: LIdP pass -> HsTyVarBndr flag pass pattern UserTyVar' s <- UserTyVar _ _ s -implicitTyVars = (wrapXRec @GP mkHsOuterImplicit) +implicitTyVars = wrapXRec @GP mkHsOuterImplicit