From 125551d781466d9c0576d81a47ad634212e7efcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Tue, 16 Jan 2024 13:37:40 +0100 Subject: [PATCH] Fix -Wall and -Wunused-packages in change-type-signature plugin --- .../hls-change-type-signature-plugin.cabal | 11 ++++++----- .../src/Ide/Plugin/ChangeTypeSignature.hs | 2 +- plugins/hls-change-type-signature-plugin/test/Main.hs | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal b/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal index ecc3cce5e5..6b55b3a60c 100644 --- a/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal +++ b/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal @@ -22,7 +22,11 @@ source-repository head type: git location: https://github.com/haskell/haskell-language-server.git +common warnings + ghc-options: -Wall -Wunused-packages + library + import: warnings exposed-modules: Ide.Plugin.ChangeTypeSignature hs-source-dirs: src build-depends: @@ -34,9 +38,7 @@ library , syb , text , transformers - , unordered-containers , containers - ghc-options: -Wall default-language: Haskell2010 default-extensions: ConstraintKinds @@ -50,18 +52,17 @@ library test-suite tests + import: warnings type: exitcode-stdio-1.0 default-language: Haskell2010 hs-source-dirs: test main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-ignore-asserts -Wall + ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-ignore-asserts build-depends: , base >=4.12 && < 5 , filepath , hls-change-type-signature-plugin , hls-test-utils == 2.6.0.0 - , lsp - , QuickCheck , regex-tdfa , text default-extensions: diff --git a/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs b/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs index d939e79147..88e7865a4b 100644 --- a/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs +++ b/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs @@ -46,7 +46,7 @@ codeActionHandler plId ideState _ CodeActionParams {_textDocument = TextDocument getDecls :: MonadIO m => PluginId -> IdeState -> NormalizedFilePath -> ExceptT PluginError m [LHsDecl GhcPs] getDecls (PluginId changeTypeSignatureId) state = runActionE (T.unpack changeTypeSignatureId <> ".GetParsedModule") state - . (fmap (hsmodDecls . unLoc . pm_parsed_source)) + . fmap (hsmodDecls . unLoc . pm_parsed_source) . useE GetParsedModule -- | Text representing a Declaration's Name diff --git a/plugins/hls-change-type-signature-plugin/test/Main.hs b/plugins/hls-change-type-signature-plugin/test/Main.hs index 98f45f3929..543d4452dc 100644 --- a/plugins/hls-change-type-signature-plugin/test/Main.hs +++ b/plugins/hls-change-type-signature-plugin/test/Main.hs @@ -95,8 +95,8 @@ goldenChangeSignature fp = goldenWithHaskellDoc def changeTypeSignaturePlugin (f codeActionTest :: FilePath -> Int -> Int -> TestTree codeActionTest fp line col = goldenChangeSignature fp $ \doc -> do - void $ waitForDiagnostics -- code actions are triggered from Diagnostics - void $ waitForAllProgressDone -- apparently some tests need this to get the CodeAction to show up + void waitForDiagnostics -- code actions are triggered from Diagnostics + void waitForAllProgressDone -- apparently some tests need this to get the CodeAction to show up actions <- getCodeActions doc (pointRange line col) foundActions <- findChangeTypeActions actions liftIO $ length foundActions @?= 1