diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 5a8874d774..7af5a71be8 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -142,7 +142,7 @@ flag cabal common cabal if flag(cabal) - build-depends: haskell-language-server:hls-cabal-plugin + build-depends: haskell-language-server:hls-cabal-plugin cpp-options: -Dhls_cabal library hls-cabal-plugin @@ -223,7 +223,7 @@ flag class common class if flag(class) - build-depends: haskell-language-server:hls-class-plugin + build-depends: haskell-language-server:hls-class-plugin cpp-options: -Dhls_class library hls-class-plugin @@ -284,7 +284,7 @@ flag callHierarchy common callHierarchy if flag(callHierarchy) - build-depends: haskell-language-server:hls-call-hierarchy-plugin + build-depends: haskell-language-server:hls-call-hierarchy-plugin cpp-options: -Dhls_callHierarchy library hls-call-hierarchy-plugin @@ -342,7 +342,7 @@ flag eval common eval if flag(eval) - build-depends: haskell-language-server:hls-eval-plugin + build-depends: haskell-language-server:hls-eval-plugin cpp-options: -Dhls_eval library hls-eval-plugin @@ -480,7 +480,7 @@ flag rename common rename if flag(rename) - build-depends: haskell-language-server:hls-rename-plugin + build-depends: haskell-language-server:hls-rename-plugin cpp-options: -Dhls_rename library hls-rename-plugin @@ -535,7 +535,7 @@ flag retrie common retrie if flag(retrie) - build-depends: haskell-language-server:hls-retrie-plugin + build-depends: haskell-language-server:hls-retrie-plugin cpp-options: -Dhls_retrie library hls-retrie-plugin @@ -596,7 +596,7 @@ flag hlint common hlint if flag(hlint) && (impl(ghc < 9.8.0) || flag(ignore-plugins-ghc-bounds)) - build-depends: haskell-language-server:hls-hlint-plugin + build-depends: haskell-language-server:hls-hlint-plugin cpp-options: -Dhls_hlint library hls-hlint-plugin @@ -606,16 +606,10 @@ library hls-hlint-plugin build-depends: , aeson , base >=4.12 && <5 - , binary , bytestring , containers - , data-default , deepseq - , Diff ^>=0.4.0 - , directory - , extra , filepath - , ghc-exactprint >=0.6.3.4 , ghcide == 2.6.0.0 , hashable , hlint >= 3.5 && < 3.9 @@ -669,7 +663,7 @@ flag stan common stan if flag(stan) && (impl(ghc > 8.8.1) && impl(ghc <= 9.2.3) || impl(ghc >= 9.4.0) && impl(ghc < 9.10.0)) - build-depends: haskell-language-server:hls-stan-plugin + build-depends: haskell-language-server:hls-stan-plugin cpp-options: -Dhls_stan library hls-stan-plugin @@ -742,7 +736,7 @@ flag moduleName common moduleName if flag(moduleName) - build-depends: haskell-language-server:hls-module-name-plugin + build-depends: haskell-language-server:hls-module-name-plugin cpp-options: -Dhls_moduleName library hls-module-name-plugin @@ -784,7 +778,7 @@ flag pragmas common pragmas if flag(pragmas) - build-depends: haskell-language-server:hls-pragmas-plugin + build-depends: haskell-language-server:hls-pragmas-plugin cpp-options: -Dhls_pragmas library hls-pragmas-plugin @@ -829,7 +823,7 @@ flag splice common splice if flag(splice) - build-depends: haskell-language-server:hls-splice-plugin + build-depends: haskell-language-server:hls-splice-plugin cpp-options: -Dhls_splice library hls-splice-plugin @@ -1001,7 +995,7 @@ flag codeRange common codeRange if flag(codeRange) - build-depends: haskell-language-server:hls-code-range-plugin + build-depends: haskell-language-server:hls-code-range-plugin cpp-options: -Dhls_codeRange library hls-code-range-plugin @@ -1058,7 +1052,7 @@ flag changeTypeSignature common changeTypeSignature if flag(changeTypeSignature) - build-depends: haskell-language-server:hls-change-type-signature-plugin + build-depends: haskell-language-server:hls-change-type-signature-plugin cpp-options: -Dhls_changeTypeSignature library hls-change-type-signature-plugin @@ -1115,7 +1109,7 @@ flag gadt common gadt if flag(gadt) - build-depends: haskell-language-server:hls-gadt-plugin + build-depends: haskell-language-server:hls-gadt-plugin cpp-options: -Dhls_gadt library hls-gadt-plugin @@ -1165,7 +1159,7 @@ flag explicitFixity common explicitFixity if flag(explicitFixity) - build-depends: haskell-language-server:hls-explicit-fixity-plugin + build-depends: haskell-language-server:hls-explicit-fixity-plugin cpp-options: -DexplicitFixity library hls-explicit-fixity-plugin @@ -1209,7 +1203,7 @@ flag explicitFields common explicitFields if flag(explicitFields) - build-depends: haskell-language-server:hls-explicit-record-fields-plugin + build-depends: haskell-language-server:hls-explicit-record-fields-plugin cpp-options: -DexplicitFields library hls-explicit-record-fields-plugin @@ -1231,7 +1225,7 @@ library hls-explicit-record-fields-plugin if flag(pedantic) ghc-options: -Wwarn=incomplete-record-updates - + test-suite hls-explicit-record-fields-plugin-tests import: defaults, test-defaults, warnings type: exitcode-stdio-1.0 @@ -1255,7 +1249,7 @@ flag overloadedRecordDot common overloadedRecordDot if flag(overloadedRecordDot) - build-depends: haskell-language-server:hls-overloaded-record-dot-plugin + build-depends: haskell-language-server:hls-overloaded-record-dot-plugin cpp-options: -Dhls_overloaded_record_dot library hls-overloaded-record-dot-plugin @@ -1302,7 +1296,7 @@ flag floskell common floskell if flag(floskell) && (impl(ghc < 9.7) || flag(ignore-plugins-ghc-bounds)) - build-depends: haskell-language-server:hls-floskell-plugin + build-depends: haskell-language-server:hls-floskell-plugin cpp-options: -Dhls_floskell library hls-floskell-plugin @@ -1341,7 +1335,7 @@ flag fourmolu common fourmolu if flag(fourmolu) - build-depends: haskell-language-server:hls-fourmolu-plugin + build-depends: haskell-language-server:hls-fourmolu-plugin cpp-options: -Dhls_fourmolu library hls-fourmolu-plugin @@ -1391,7 +1385,7 @@ flag ormolu common ormolu if flag(ormolu) - build-depends: haskell-language-server:hls-ormolu-plugin + build-depends: haskell-language-server:hls-ormolu-plugin cpp-options: -Dhls_ormolu library hls-ormolu-plugin @@ -1441,7 +1435,7 @@ flag stylishHaskell common stylishHaskell if flag(stylishHaskell) && (impl(ghc < 9.8.0) || flag(ignore-plugins-ghc-bounds)) - build-depends: haskell-language-server:hls-stylish-haskell-plugin + build-depends: haskell-language-server:hls-stylish-haskell-plugin cpp-options: -Dhls_stylishHaskell library hls-stylish-haskell-plugin @@ -1483,7 +1477,7 @@ flag refactor common refactor if flag(refactor) - build-depends: haskell-language-server:hls-refactor-plugin + build-depends: haskell-language-server:hls-refactor-plugin cpp-options: -Dhls_refactor library hls-refactor-plugin @@ -1561,7 +1555,7 @@ test-suite hls-refactor-plugin-tests hs-source-dirs: plugins/hls-refactor-plugin/test main-is: Main.hs other-modules: Test.AddArgument - ghc-options: -O0 + ghc-options: -O0 build-depends: , base , filepath @@ -1596,7 +1590,7 @@ flag semanticTokens common semanticTokens if flag(semanticTokens) - build-depends: haskell-language-server:hls-semantic-tokens-plugin + build-depends: haskell-language-server:hls-semantic-tokens-plugin cpp-options: -Dhls_semanticTokens library hls-semantic-tokens-plugin @@ -1854,7 +1848,7 @@ test-suite func-test type: exitcode-stdio-1.0 build-tool-depends: haskell-language-server:haskell-language-server, - ghcide:ghcide-test-preprocessor + ghcide:ghcide-test-preprocessor build-depends: , bytestring @@ -1907,7 +1901,7 @@ test-suite wrapper-test type: exitcode-stdio-1.0 build-tool-depends: haskell-language-server:haskell-language-server-wrapper, - haskell-language-server:haskell-language-server + haskell-language-server:haskell-language-server build-depends: process diff --git a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs index a5527a027b..68eef692f2 100644 --- a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs +++ b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs @@ -16,7 +16,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TupleSections #-} -{-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-} {-# OPTIONS_GHC -Wno-orphans #-} @@ -142,8 +141,7 @@ import Development.IDE.Spans.Pragmas (LineSplitTe lineSplitTextEdits, nextPragmaLine) import GHC.Generics (Generic) -#if MIN_VERSION_apply_refact(0,12,0) -#else +#if !MIN_VERSION_apply_refact(0,12,0) import System.Environment (setEnv, unsetEnv) #endif diff --git a/plugins/hls-hlint-plugin/test/Main.hs b/plugins/hls-hlint-plugin/test/Main.hs index f97fb57f11..c221a68ff8 100644 --- a/plugins/hls-hlint-plugin/test/Main.hs +++ b/plugins/hls-hlint-plugin/test/Main.hs @@ -9,17 +9,16 @@ module Main import Control.Lens ((^.)) import Control.Monad (when) -import Data.Aeson (Value (..), object, toJSON, (.=)) +import Data.Aeson (Value (..), object, (.=)) import Data.Functor (void) import Data.List (find) import qualified Data.Map as Map import Data.Maybe (fromJust, isJust) import Data.Row ((.+), (.==)) import qualified Data.Text as T -import Ide.Plugin.Config (Config (..), PluginConfig (..)) +import Ide.Plugin.Config (Config (..)) import qualified Ide.Plugin.Config as Plugin import qualified Ide.Plugin.Hlint as HLint -import Ide.Types (PluginId) import qualified Language.LSP.Protocol.Lens as L import System.FilePath (()) import Test.Hls @@ -383,10 +382,6 @@ data Point = Point { column :: !Int } -makePoint line column - | line >= 1 && column >= 1 = Point line column - | otherwise = error "Line or column is less than 1." - pointToRange :: Point -> Range pointToRange Point {..} | line <- fromIntegral $ subtract 1 line @@ -402,10 +397,6 @@ makeCodeActionNotFoundAtString :: Point -> String makeCodeActionNotFoundAtString Point {..} = "CodeAction not found at line: " <> show line <> ", column: " <> show column -makeCodeActionFoundAtString :: Point -> String -makeCodeActionFoundAtString Point {..} = - "CodeAction found at line: " <> show line <> ", column: " <> show column - ignoreHintGoldenTest :: TestName -> FilePath -> Point -> T.Text -> TestTree ignoreHintGoldenTest testCaseName goldenFilename point hintName = goldenTest testCaseName goldenFilename point (getIgnoreHintText hintName) @@ -417,7 +408,7 @@ applyHintGoldenTest testCaseName goldenFilename point hintName = do goldenTest :: TestName -> FilePath -> Point -> T.Text -> TestTree goldenTest testCaseName goldenFilename point hintText = setupGoldenHlintTest testCaseName goldenFilename $ \document -> do - waitForDiagnosticsFromSource document "hlint" + _ <- waitForDiagnosticsFromSource document "hlint" actions <- getCodeActions document $ pointToRange point case find ((== Just hintText) . getCodeActionTitle) actions of Just (InR codeAction) -> do @@ -441,7 +432,7 @@ applyHintGoldenResolveTest testCaseName goldenFilename point hintName = do goldenResolveTest :: TestName -> FilePath -> Point -> T.Text -> TestTree goldenResolveTest testCaseName goldenFilename point hintText = setupGoldenHlintResolveTest testCaseName goldenFilename $ \document -> do - waitForDiagnosticsFromSource document "hlint" + _ <- waitForDiagnosticsFromSource document "hlint" actions <- getAndResolveCodeActions document $ pointToRange point case find ((== Just hintText) . getCodeActionTitle) actions of Just (InR codeAction) -> executeCodeAction codeAction