From cbfb36813b3225f0a4a58b32932b6d801f799ee4 Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 13:29:43 +0800 Subject: [PATCH 1/9] Class plugin --- haskell-language-server.cabal | 1 - .../hls-class-plugin/hls-class-plugin.cabal | 81 ++++++++++++++----- .../hls-class-plugin/test/Main.hs | 14 ++-- plugins/hls-class-plugin/test/Server.hs | 18 +++++ .../test/testdata}/T1.eq.expected.hs | 0 .../hls-class-plugin/test/testdata}/T1.hs | 0 .../test/testdata}/T1.ne.expected.hs | 0 .../test/testdata}/T2.fmap.expected.hs | 0 .../hls-class-plugin/test/testdata}/T2.hs | 0 .../test/testdata}/T3.1.expected.hs | 0 .../test/testdata}/T3.2.expected.hs | 0 .../hls-class-plugin/test/testdata}/T3.hs | 0 .../test/testdata}/T4.expected.hs | 0 .../hls-class-plugin/test/testdata}/T4.hs | 0 plugins/hls-eval-plugin/hls-eval-plugin.cabal | 1 - plugins/hls-eval-plugin/test/Main.hs | 2 +- .../hls-stylish-haskell-plugin.cabal | 1 - 17 files changed, 87 insertions(+), 31 deletions(-) rename test/functional/Class.hs => plugins/hls-class-plugin/test/Main.hs (91%) create mode 100644 plugins/hls-class-plugin/test/Server.hs rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T1.eq.expected.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T1.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T1.ne.expected.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T2.fmap.expected.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T2.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T3.1.expected.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T3.2.expected.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T3.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T4.expected.hs (100%) rename {test/testdata/class => plugins/hls-class-plugin/test/testdata}/T4.hs (100%) diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 37e87c4b31..caf7e045c5 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -398,7 +398,6 @@ test-suite func-test main-is: Main.hs other-modules: - Class Command Completion Config diff --git a/plugins/hls-class-plugin/hls-class-plugin.cabal b/plugins/hls-class-plugin/hls-class-plugin.cabal index 5c8e576681..2011ae0cad 100644 --- a/plugins/hls-class-plugin/hls-class-plugin.cabal +++ b/plugins/hls-class-plugin/hls-class-plugin.cabal @@ -1,10 +1,13 @@ -cabal-version: 2.2 +cabal-version: 2.4 name: hls-class-plugin version: 1.0.0.0 -synopsis: Class/instance management plugin for Haskell Language Server +synopsis: + Class/instance management plugin for Haskell Language Server + description: - Class/instance management plugin for Haskell Language Server. - For usage, please see README of HLS on GitHub at + Class/instance management plugin for Haskell Language Server. + For usage, please see README of HLS on GitHub at + license: Apache-2.0 license-file: LICENSE author: Junyoung Clare Jang @@ -13,24 +16,60 @@ homepage: https://github.com/haskell/haskell-language-server#readme bug-reports: https://github.com/haskell/haskell-language-server/issues category: Development build-type: Simple +extra-source-files: + LICENSE + test/testdata/**/*.hs library - exposed-modules: Ide.Plugin.Class - hs-source-dirs: src - build-depends: aeson - , base >=4.12 && <5 - , containers - , lsp - , hls-plugin-api >= 1.0 && < 1.2 - , ghc - , ghc-exactprint - , ghcide ^>= 1.1.0.0 - , lens - , shake - , text - , transformers - , unordered-containers + exposed-modules: Ide.Plugin.Class + hs-source-dirs: src + build-depends: + , aeson + , base >=4.12 && <5 + , containers + , ghc + , ghc-exactprint + , ghcide ^>=1.1.0.0 + , hls-plugin-api >=1.0 && <1.2 + , lens + , lsp + , shake + , text + , transformers + , unordered-containers + + default-language: Haskell2010 + default-extensions: + DataKinds + TypeOperators + ghc-options: -Wno-unticked-promoted-constructors + +executable test-server default-language: Haskell2010 - default-extensions: DataKinds, TypeOperators - ghc-options: -Wno-unticked-promoted-constructors + build-depends: + , base + , data-default + , ghcide + , hls-class-plugin + , hls-plugin-api + + main-is: Server.hs + hs-source-dirs: test + ghc-options: -threaded + +test-suite tests + type: exitcode-stdio-1.0 + default-language: Haskell2010 + build-tool-depends: hls-class-plugin:test-server -any + hs-source-dirs: test + main-is: Main.hs + build-depends: + , base + , bytestring + , filepath + , hls-test-utils + , lens + , lsp-test + , lsp-types + , text diff --git a/test/functional/Class.hs b/plugins/hls-class-plugin/test/Main.hs similarity index 91% rename from test/functional/Class.hs rename to plugins/hls-class-plugin/test/Main.hs index 65658c464f..af8495e46b 100644 --- a/test/functional/Class.hs +++ b/plugins/hls-class-plugin/test/Main.hs @@ -2,8 +2,8 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} -module Class - ( tests +module Main + ( main ) where @@ -14,11 +14,14 @@ import qualified Language.LSP.Types.Lens as J import System.FilePath import Test.Hls +main :: IO () +main = defaultTestRunner tests + tests :: TestTree tests = testGroup "class" [ testCase "Produces addMinimalMethodPlaceholders code actions for one instance" $ do - runSession hlsCommand fullCaps classPath $ do + runSession testCommand fullCaps classPath $ do doc <- openDoc "T1.hs" "haskell" _ <- waitForDiagnosticsFromSource doc "typecheck" caResults <- getAllCodeActions doc @@ -26,7 +29,6 @@ tests = testGroup @?= [ Just "Add placeholders for '=='" , Just "Add placeholders for '/='" - , Just "Disable \"missing-methods\" warnings" ] , glodenTest "Creates a placeholder for '=='" "T1" "eq" $ \(eqAction:_) -> do @@ -54,12 +56,12 @@ _CACodeAction = prism' InR $ \case _ -> Nothing classPath :: FilePath -classPath = "test" "testdata" "class" +classPath = "test" "testdata" glodenTest :: String -> FilePath -> FilePath -> ([CodeAction] -> Session ()) -> TestTree glodenTest name fp deco execute = goldenGitDiff name (classPath fpWithDeco <.> "expected" <.> "hs") - $ runSession hlsCommand fullCaps classPath + $ runSession testCommand fullCaps classPath $ do doc <- openDoc (fp <.> "hs") "haskell" _ <- waitForDiagnosticsFromSource doc "typecheck" diff --git a/plugins/hls-class-plugin/test/Server.hs b/plugins/hls-class-plugin/test/Server.hs new file mode 100644 index 0000000000..584c52cd1b --- /dev/null +++ b/plugins/hls-class-plugin/test/Server.hs @@ -0,0 +1,18 @@ + +{-# LANGUAGE OverloadedStrings #-} +module Main(main) where + +import Data.Default +import Development.IDE.Main +import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide +import qualified Ide.Plugin.Class as Class +import Ide.Plugin.Config +import Ide.PluginUtils + +main :: IO () +main = defaultMain def + { argsHlsPlugins = pluginDescToIdePlugins $ + [ Class.descriptor "class" + ] <> + Ghcide.descriptors + } diff --git a/test/testdata/class/T1.eq.expected.hs b/plugins/hls-class-plugin/test/testdata/T1.eq.expected.hs similarity index 100% rename from test/testdata/class/T1.eq.expected.hs rename to plugins/hls-class-plugin/test/testdata/T1.eq.expected.hs diff --git a/test/testdata/class/T1.hs b/plugins/hls-class-plugin/test/testdata/T1.hs similarity index 100% rename from test/testdata/class/T1.hs rename to plugins/hls-class-plugin/test/testdata/T1.hs diff --git a/test/testdata/class/T1.ne.expected.hs b/plugins/hls-class-plugin/test/testdata/T1.ne.expected.hs similarity index 100% rename from test/testdata/class/T1.ne.expected.hs rename to plugins/hls-class-plugin/test/testdata/T1.ne.expected.hs diff --git a/test/testdata/class/T2.fmap.expected.hs b/plugins/hls-class-plugin/test/testdata/T2.fmap.expected.hs similarity index 100% rename from test/testdata/class/T2.fmap.expected.hs rename to plugins/hls-class-plugin/test/testdata/T2.fmap.expected.hs diff --git a/test/testdata/class/T2.hs b/plugins/hls-class-plugin/test/testdata/T2.hs similarity index 100% rename from test/testdata/class/T2.hs rename to plugins/hls-class-plugin/test/testdata/T2.hs diff --git a/test/testdata/class/T3.1.expected.hs b/plugins/hls-class-plugin/test/testdata/T3.1.expected.hs similarity index 100% rename from test/testdata/class/T3.1.expected.hs rename to plugins/hls-class-plugin/test/testdata/T3.1.expected.hs diff --git a/test/testdata/class/T3.2.expected.hs b/plugins/hls-class-plugin/test/testdata/T3.2.expected.hs similarity index 100% rename from test/testdata/class/T3.2.expected.hs rename to plugins/hls-class-plugin/test/testdata/T3.2.expected.hs diff --git a/test/testdata/class/T3.hs b/plugins/hls-class-plugin/test/testdata/T3.hs similarity index 100% rename from test/testdata/class/T3.hs rename to plugins/hls-class-plugin/test/testdata/T3.hs diff --git a/test/testdata/class/T4.expected.hs b/plugins/hls-class-plugin/test/testdata/T4.expected.hs similarity index 100% rename from test/testdata/class/T4.expected.hs rename to plugins/hls-class-plugin/test/testdata/T4.expected.hs diff --git a/test/testdata/class/T4.hs b/plugins/hls-class-plugin/test/testdata/T4.hs similarity index 100% rename from test/testdata/class/T4.hs rename to plugins/hls-class-plugin/test/testdata/T4.hs diff --git a/plugins/hls-eval-plugin/hls-eval-plugin.cabal b/plugins/hls-eval-plugin/hls-eval-plugin.cabal index 30a8512d24..7b2dcaf957 100644 --- a/plugins/hls-eval-plugin/hls-eval-plugin.cabal +++ b/plugins/hls-eval-plugin/hls-eval-plugin.cabal @@ -111,7 +111,6 @@ test-suite tests build-tool-depends: hls-eval-plugin:test-server -any hs-source-dirs: test main-is: Main.hs - ghc-options: -Wunused-packages build-depends: , aeson diff --git a/plugins/hls-eval-plugin/test/Main.hs b/plugins/hls-eval-plugin/test/Main.hs index 8a09126edd..3cc5935601 100644 --- a/plugins/hls-eval-plugin/test/Main.hs +++ b/plugins/hls-eval-plugin/test/Main.hs @@ -213,4 +213,4 @@ replaceUnicodeQuotes :: T.Text -> T.Text replaceUnicodeQuotes = T.replace "‘" "'" . T.replace "’" "'" evalPath :: FilePath -evalPath = "test/testdata" +evalPath = "test" "testdata" diff --git a/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal b/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal index ceeffc17bc..051fbe40bf 100644 --- a/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal +++ b/plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal @@ -53,6 +53,5 @@ test-suite tests build-depends: , base , bytestring - , hls-stylish-haskell-plugin , hls-test-utils , text From 63208e09329b6f7473049c5b3ea5361d617de5a8 Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 14:09:50 +0800 Subject: [PATCH 2/9] Splice plugin, extract hlsCommand from hls-test-utils --- haskell-language-server.cabal | 5 +- hls-test-utils/src/Test/Hls/Util.hs | 25 ----- .../hls-splice-plugin/hls-splice-plugin.cabal | 102 +++++++++++++----- .../hls-splice-plugin/test/Main.hs | 11 +- plugins/hls-splice-plugin/test/Server.hs | 17 +++ .../hls-splice-plugin/test/testdata}/QQ.hs | 0 .../test/testdata}/TDeclKindError.hs | 0 .../test/testdata}/TDeclKindError.hs.error | 0 .../test/testdata}/TDeclKindError.hs.expected | 0 .../test/testdata}/TErrorExp.hs | 0 .../test/testdata}/TErrorExp.hs.expected | 0 .../test/testdata}/TErrorPat.hs | 0 .../test/testdata}/TErrorPat.hs.expected | 0 .../test/testdata}/TQQDecl.hs | 0 .../test/testdata}/TQQDecl.hs.expected | 0 .../test/testdata}/TQQExp.hs | 0 .../test/testdata}/TQQExp.hs.expected | 0 .../test/testdata}/TQQExpError.hs | 0 .../test/testdata}/TQQExpError.hs.expected | 0 .../test/testdata}/TQQPat.hs | 0 .../test/testdata}/TQQPat.hs.expected | 0 .../test/testdata}/TQQPatError.hs | 0 .../test/testdata}/TQQPatError.hs.expected | 0 .../test/testdata}/TQQType.hs | 0 .../test/testdata}/TQQType.hs.expected | 0 .../test/testdata}/TQQTypeTypeError.hs | 0 .../testdata}/TQQTypeTypeError.hs.expected | 0 .../test/testdata}/TSimpleDecl.hs | 0 .../test/testdata}/TSimpleDecl.hs.expected | 0 .../test/testdata}/TSimpleExp.hs | 0 .../test/testdata}/TSimpleExp.hs.expected | 0 .../test/testdata}/TSimplePat.hs | 0 .../test/testdata}/TSimplePat.hs.expected | 0 .../test/testdata}/TSimpleType.hs | 0 .../test/testdata}/TSimpleType.hs.expected | 0 .../test/testdata}/TTypeAppExp.hs | 0 .../test/testdata}/TTypeAppExp.hs.expected | 0 .../test/testdata}/TTypeKindError.hs | 0 .../test/testdata}/TTypeKindError.hs.error | 0 .../test/testdata}/TTypeKindError.hs.expected | 0 .../test/testdata}/TTypeTypeError.hs | 0 .../test/testdata}/TTypeTypeError.hs.expected | 0 .../hls-splice-plugin/test/testdata}/hie.yaml | 0 test/functional/Command.hs | 1 + test/functional/Completion.hs | 1 + test/functional/Config.hs | 1 + test/functional/Deferred.hs | 1 + test/functional/Definition.hs | 1 + test/functional/Diagnostic.hs | 1 + test/functional/Format.hs | 1 + test/functional/FunctionalCodeAction.hs | 1 + test/functional/FunctionalLiquid.hs | 2 + test/functional/HaddockComments.hs | 1 + test/functional/HieBios.hs | 1 + test/functional/Highlight.hs | 1 + test/functional/Main.hs | 6 +- test/functional/ModuleName.hs | 5 +- test/functional/Progress.hs | 1 + test/functional/Reference.hs | 1 + test/functional/Rename.hs | 1 + test/functional/Symbol.hs | 1 + test/functional/TypeDefinition.hs | 1 + test/testdata/splice/.gitignore | 1 - test/utils/Test/Hls/Command.hs | 32 ++++++ 64 files changed, 154 insertions(+), 68 deletions(-) rename test/functional/Splice.hs => plugins/hls-splice-plugin/test/Main.hs (96%) create mode 100644 plugins/hls-splice-plugin/test/Server.hs rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/QQ.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TDeclKindError.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TDeclKindError.hs.error (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TDeclKindError.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TErrorExp.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TErrorExp.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TErrorPat.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TErrorPat.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQDecl.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQDecl.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQExp.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQExp.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQExpError.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQExpError.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQPat.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQPat.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQPatError.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQPatError.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQType.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQType.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQTypeTypeError.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TQQTypeTypeError.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimpleDecl.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimpleDecl.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimpleExp.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimpleExp.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimplePat.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimplePat.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimpleType.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TSimpleType.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TTypeAppExp.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TTypeAppExp.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TTypeKindError.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TTypeKindError.hs.error (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TTypeKindError.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TTypeTypeError.hs (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/TTypeTypeError.hs.expected (100%) rename {test/testdata/splice => plugins/hls-splice-plugin/test/testdata}/hie.yaml (100%) delete mode 100644 test/testdata/splice/.gitignore create mode 100644 test/utils/Test/Hls/Command.hs diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index caf7e045c5..082f5cbc4c 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -394,7 +394,7 @@ test-suite func-test , containers , unordered-containers - hs-source-dirs: test/functional plugins/hls-splice-plugin/src + hs-source-dirs: test/functional test/utils main-is: Main.hs other-modules: @@ -416,9 +416,8 @@ test-suite func-test Rename Symbol TypeDefinition - Splice HaddockComments - Ide.Plugin.Splice.Types + Test.Hls.Command default-extensions: OverloadedStrings ghc-options: diff --git a/hls-test-utils/src/Test/Hls/Util.hs b/hls-test-utils/src/Test/Hls/Util.hs index 0b64ea7338..8573089847 100644 --- a/hls-test-utils/src/Test/Hls/Util.hs +++ b/hls-test-utils/src/Test/Hls/Util.hs @@ -15,9 +15,6 @@ module Test.Hls.Util , ghcVersion, GhcVersion(..) , hostOS, OS(..) , matchesCurrentEnv, EnvSpec(..) - , hlsCommand - , hlsCommandExamplePlugin - , hlsCommandVomit , ignoreForGhcVersions , ignoreInEnv , inspectCodeAction @@ -26,7 +23,6 @@ module Test.Hls.Util , knownBrokenOnWindows , knownBrokenForGhcVersions , knownBrokenInEnv - , logFilePath , setupBuildToolFiles , SymbolLocation , waitForDiagnosticsFrom @@ -57,7 +53,6 @@ import System.Environment import System.Time.Extra (Seconds, sleep) import System.FilePath import System.IO.Temp -import System.IO.Unsafe import Test.Hspec.Runner import Test.Hspec.Core.Formatters hiding (Seconds) import Test.Tasty (TestTree) @@ -164,26 +159,6 @@ ignoreForGhcVersions vers reason | ghcVersion `elem` vers = ignoreTestBecause reason | otherwise = id -logFilePath :: String -logFilePath = "hls-" ++ show ghcVersion ++ ".log" - --- | The command to execute the version of hls for the current compiler. --- --- Both @stack test@ and @cabal new-test@ setup the environment so @hls@ is --- on PATH. Cabal seems to respond to @build-tool-depends@ specifically while --- stack just puts all project executables on PATH. -hlsCommand :: String -{-# NOINLINE hlsCommand #-} -hlsCommand = unsafePerformIO $ do - testExe <- fromMaybe "haskell-language-server" <$> lookupEnv "HLS_TEST_EXE" - pure $ testExe ++ " --lsp -d -j2 -l test-logs/" ++ logFilePath - -hlsCommandVomit :: String -hlsCommandVomit = hlsCommand ++ " --vomit" - -hlsCommandExamplePlugin :: String -hlsCommandExamplePlugin = hlsCommand ++ " --example" - -- --------------------------------------------------------------------- hieYamlCradleDirectContents :: String diff --git a/plugins/hls-splice-plugin/hls-splice-plugin.cabal b/plugins/hls-splice-plugin/hls-splice-plugin.cabal index 52d3a46efd..94c9a52606 100644 --- a/plugins/hls-splice-plugin/hls-splice-plugin.cabal +++ b/plugins/hls-splice-plugin/hls-splice-plugin.cabal @@ -1,39 +1,85 @@ cabal-version: 2.2 name: hls-splice-plugin version: 1.0.0.0 -synopsis: HLS Plugin to expand TemplateHaskell Splices and QuasiQuotes -description: HLS Plugin to expand TemplateHaskell Splices and QuasiQuotes. +synopsis: + HLS Plugin to expand TemplateHaskell Splices and QuasiQuotes + +description: + HLS Plugin to expand TemplateHaskell Splices and QuasiQuotes. + license: Apache-2.0 license-file: LICENSE -author: https://github.com/haskell/haskell-language-server/contributors -maintainer: https://github.com/haskell/haskell-language-server/contributors +author: + https://github.com/haskell/haskell-language-server/contributors + +maintainer: + https://github.com/haskell/haskell-language-server/contributors + category: Development build-type: Simple +extra-source-files: + LICENSE + test/testdata/*.expected + test/testdata/*.hs + test/testdata/*.yaml library - exposed-modules: Ide.Plugin.Splice - ghc-options: -Wall -Wno-unticked-promoted-constructors - other-modules: Ide.Plugin.Splice.Types - hs-source-dirs: src - build-depends: aeson - , base >=4.12 && <5 - , containers - , extra - , foldl - , lsp - , hls-plugin-api >= 1.0 && < 1.2 - , ghc - , ghc-exactprint - , ghcide ^>= 1.1.0.0 - , lens - , dlist - , retrie - , shake - , syb - , text - , transformers - , unordered-containers - , unliftio-core + exposed-modules: + Ide.Plugin.Splice + Ide.Plugin.Splice.Types + ghc-options: -Wall -Wno-unticked-promoted-constructors + hs-source-dirs: src + build-depends: + , aeson + , base >=4.12 && <5 + , containers + , dlist + , extra + , foldl + , ghc + , ghc-exactprint + , ghcide ^>=1.1.0.0 + , hls-plugin-api >=1.0 && <1.2 + , lens + , lsp + , retrie + , shake + , syb + , text + , transformers + , unliftio-core + , unordered-containers + + default-language: Haskell2010 + default-extensions: + DataKinds + TypeOperators + +executable test-server default-language: Haskell2010 - default-extensions: DataKinds, TypeOperators + build-depends: + , base + , data-default + , ghcide + , hls-plugin-api + , hls-splice-plugin + + main-is: Server.hs + hs-source-dirs: test + ghc-options: -threaded + +test-suite tests + type: exitcode-stdio-1.0 + default-language: Haskell2010 + build-tool-depends: hls-splice-plugin:test-server -any + hs-source-dirs: test + main-is: Main.hs + build-depends: + , base + , directory + , extra + , filepath + , hls-splice-plugin + , hls-test-utils + , text diff --git a/test/functional/Splice.hs b/plugins/hls-splice-plugin/test/Main.hs similarity index 96% rename from test/functional/Splice.hs rename to plugins/hls-splice-plugin/test/Main.hs index 7f17cab0ca..78304cccd6 100644 --- a/test/functional/Splice.hs +++ b/plugins/hls-splice-plugin/test/Main.hs @@ -6,7 +6,7 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE ViewPatterns #-} -module Splice (tests) where +module Main (main) where import Control.Monad import Data.List (find) @@ -19,6 +19,9 @@ import System.FilePath import System.Time.Extra (sleep) import Test.Hls +main :: IO () +main = defaultTestRunner tests + tests :: TestTree tests = testGroup @@ -61,7 +64,7 @@ tests = goldenTest :: FilePath -> ExpandStyle -> Int -> Int -> TestTree goldenTest input tc line col = testCase (input <> " (golden)") $ do - runSession hlsCommand fullCaps spliceTestPath $ do + runSession testCommand fullCaps spliceTestPath $ do doc <- openDoc input "haskell" _ <- waitForDiagnostics actions <- getCodeActions doc $ pointRange line col @@ -83,7 +86,7 @@ goldenTest input tc line col = goldenTestWithEdit :: FilePath -> ExpandStyle -> Int -> Int -> TestTree goldenTestWithEdit input tc line col = testCase (input <> " (golden)") $ do - runSession hlsCommand fullCaps spliceTestPath $ do + runSession testCommand fullCaps spliceTestPath $ do doc <- openDoc input "haskell" orig <- documentContents doc let lns = T.lines orig @@ -114,7 +117,7 @@ goldenTestWithEdit input tc line col = _ -> liftIO $ assertFailure "No CodeAction detected" spliceTestPath :: FilePath -spliceTestPath = "test/testdata/splice" +spliceTestPath = "test" "testdata" pointRange :: Int -> Int -> Range pointRange diff --git a/plugins/hls-splice-plugin/test/Server.hs b/plugins/hls-splice-plugin/test/Server.hs new file mode 100644 index 0000000000..3bf0d1460c --- /dev/null +++ b/plugins/hls-splice-plugin/test/Server.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedStrings #-} +module Main(main) where + +import Data.Default +import Development.IDE.Main +import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide +import Ide.Plugin.Config +import qualified Ide.Plugin.Splice as Splice +import Ide.PluginUtils + +main :: IO () +main = defaultMain def + { argsHlsPlugins = pluginDescToIdePlugins $ + [ Splice.descriptor "splice" + ] <> + Ghcide.descriptors + } diff --git a/test/testdata/splice/QQ.hs b/plugins/hls-splice-plugin/test/testdata/QQ.hs similarity index 100% rename from test/testdata/splice/QQ.hs rename to plugins/hls-splice-plugin/test/testdata/QQ.hs diff --git a/test/testdata/splice/TDeclKindError.hs b/plugins/hls-splice-plugin/test/testdata/TDeclKindError.hs similarity index 100% rename from test/testdata/splice/TDeclKindError.hs rename to plugins/hls-splice-plugin/test/testdata/TDeclKindError.hs diff --git a/test/testdata/splice/TDeclKindError.hs.error b/plugins/hls-splice-plugin/test/testdata/TDeclKindError.hs.error similarity index 100% rename from test/testdata/splice/TDeclKindError.hs.error rename to plugins/hls-splice-plugin/test/testdata/TDeclKindError.hs.error diff --git a/test/testdata/splice/TDeclKindError.hs.expected b/plugins/hls-splice-plugin/test/testdata/TDeclKindError.hs.expected similarity index 100% rename from test/testdata/splice/TDeclKindError.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TDeclKindError.hs.expected diff --git a/test/testdata/splice/TErrorExp.hs b/plugins/hls-splice-plugin/test/testdata/TErrorExp.hs similarity index 100% rename from test/testdata/splice/TErrorExp.hs rename to plugins/hls-splice-plugin/test/testdata/TErrorExp.hs diff --git a/test/testdata/splice/TErrorExp.hs.expected b/plugins/hls-splice-plugin/test/testdata/TErrorExp.hs.expected similarity index 100% rename from test/testdata/splice/TErrorExp.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TErrorExp.hs.expected diff --git a/test/testdata/splice/TErrorPat.hs b/plugins/hls-splice-plugin/test/testdata/TErrorPat.hs similarity index 100% rename from test/testdata/splice/TErrorPat.hs rename to plugins/hls-splice-plugin/test/testdata/TErrorPat.hs diff --git a/test/testdata/splice/TErrorPat.hs.expected b/plugins/hls-splice-plugin/test/testdata/TErrorPat.hs.expected similarity index 100% rename from test/testdata/splice/TErrorPat.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TErrorPat.hs.expected diff --git a/test/testdata/splice/TQQDecl.hs b/plugins/hls-splice-plugin/test/testdata/TQQDecl.hs similarity index 100% rename from test/testdata/splice/TQQDecl.hs rename to plugins/hls-splice-plugin/test/testdata/TQQDecl.hs diff --git a/test/testdata/splice/TQQDecl.hs.expected b/plugins/hls-splice-plugin/test/testdata/TQQDecl.hs.expected similarity index 100% rename from test/testdata/splice/TQQDecl.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TQQDecl.hs.expected diff --git a/test/testdata/splice/TQQExp.hs b/plugins/hls-splice-plugin/test/testdata/TQQExp.hs similarity index 100% rename from test/testdata/splice/TQQExp.hs rename to plugins/hls-splice-plugin/test/testdata/TQQExp.hs diff --git a/test/testdata/splice/TQQExp.hs.expected b/plugins/hls-splice-plugin/test/testdata/TQQExp.hs.expected similarity index 100% rename from test/testdata/splice/TQQExp.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TQQExp.hs.expected diff --git a/test/testdata/splice/TQQExpError.hs b/plugins/hls-splice-plugin/test/testdata/TQQExpError.hs similarity index 100% rename from test/testdata/splice/TQQExpError.hs rename to plugins/hls-splice-plugin/test/testdata/TQQExpError.hs diff --git a/test/testdata/splice/TQQExpError.hs.expected b/plugins/hls-splice-plugin/test/testdata/TQQExpError.hs.expected similarity index 100% rename from test/testdata/splice/TQQExpError.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TQQExpError.hs.expected diff --git a/test/testdata/splice/TQQPat.hs b/plugins/hls-splice-plugin/test/testdata/TQQPat.hs similarity index 100% rename from test/testdata/splice/TQQPat.hs rename to plugins/hls-splice-plugin/test/testdata/TQQPat.hs diff --git a/test/testdata/splice/TQQPat.hs.expected b/plugins/hls-splice-plugin/test/testdata/TQQPat.hs.expected similarity index 100% rename from test/testdata/splice/TQQPat.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TQQPat.hs.expected diff --git a/test/testdata/splice/TQQPatError.hs b/plugins/hls-splice-plugin/test/testdata/TQQPatError.hs similarity index 100% rename from test/testdata/splice/TQQPatError.hs rename to plugins/hls-splice-plugin/test/testdata/TQQPatError.hs diff --git a/test/testdata/splice/TQQPatError.hs.expected b/plugins/hls-splice-plugin/test/testdata/TQQPatError.hs.expected similarity index 100% rename from test/testdata/splice/TQQPatError.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TQQPatError.hs.expected diff --git a/test/testdata/splice/TQQType.hs b/plugins/hls-splice-plugin/test/testdata/TQQType.hs similarity index 100% rename from test/testdata/splice/TQQType.hs rename to plugins/hls-splice-plugin/test/testdata/TQQType.hs diff --git a/test/testdata/splice/TQQType.hs.expected b/plugins/hls-splice-plugin/test/testdata/TQQType.hs.expected similarity index 100% rename from test/testdata/splice/TQQType.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TQQType.hs.expected diff --git a/test/testdata/splice/TQQTypeTypeError.hs b/plugins/hls-splice-plugin/test/testdata/TQQTypeTypeError.hs similarity index 100% rename from test/testdata/splice/TQQTypeTypeError.hs rename to plugins/hls-splice-plugin/test/testdata/TQQTypeTypeError.hs diff --git a/test/testdata/splice/TQQTypeTypeError.hs.expected b/plugins/hls-splice-plugin/test/testdata/TQQTypeTypeError.hs.expected similarity index 100% rename from test/testdata/splice/TQQTypeTypeError.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TQQTypeTypeError.hs.expected diff --git a/test/testdata/splice/TSimpleDecl.hs b/plugins/hls-splice-plugin/test/testdata/TSimpleDecl.hs similarity index 100% rename from test/testdata/splice/TSimpleDecl.hs rename to plugins/hls-splice-plugin/test/testdata/TSimpleDecl.hs diff --git a/test/testdata/splice/TSimpleDecl.hs.expected b/plugins/hls-splice-plugin/test/testdata/TSimpleDecl.hs.expected similarity index 100% rename from test/testdata/splice/TSimpleDecl.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TSimpleDecl.hs.expected diff --git a/test/testdata/splice/TSimpleExp.hs b/plugins/hls-splice-plugin/test/testdata/TSimpleExp.hs similarity index 100% rename from test/testdata/splice/TSimpleExp.hs rename to plugins/hls-splice-plugin/test/testdata/TSimpleExp.hs diff --git a/test/testdata/splice/TSimpleExp.hs.expected b/plugins/hls-splice-plugin/test/testdata/TSimpleExp.hs.expected similarity index 100% rename from test/testdata/splice/TSimpleExp.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TSimpleExp.hs.expected diff --git a/test/testdata/splice/TSimplePat.hs b/plugins/hls-splice-plugin/test/testdata/TSimplePat.hs similarity index 100% rename from test/testdata/splice/TSimplePat.hs rename to plugins/hls-splice-plugin/test/testdata/TSimplePat.hs diff --git a/test/testdata/splice/TSimplePat.hs.expected b/plugins/hls-splice-plugin/test/testdata/TSimplePat.hs.expected similarity index 100% rename from test/testdata/splice/TSimplePat.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TSimplePat.hs.expected diff --git a/test/testdata/splice/TSimpleType.hs b/plugins/hls-splice-plugin/test/testdata/TSimpleType.hs similarity index 100% rename from test/testdata/splice/TSimpleType.hs rename to plugins/hls-splice-plugin/test/testdata/TSimpleType.hs diff --git a/test/testdata/splice/TSimpleType.hs.expected b/plugins/hls-splice-plugin/test/testdata/TSimpleType.hs.expected similarity index 100% rename from test/testdata/splice/TSimpleType.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TSimpleType.hs.expected diff --git a/test/testdata/splice/TTypeAppExp.hs b/plugins/hls-splice-plugin/test/testdata/TTypeAppExp.hs similarity index 100% rename from test/testdata/splice/TTypeAppExp.hs rename to plugins/hls-splice-plugin/test/testdata/TTypeAppExp.hs diff --git a/test/testdata/splice/TTypeAppExp.hs.expected b/plugins/hls-splice-plugin/test/testdata/TTypeAppExp.hs.expected similarity index 100% rename from test/testdata/splice/TTypeAppExp.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TTypeAppExp.hs.expected diff --git a/test/testdata/splice/TTypeKindError.hs b/plugins/hls-splice-plugin/test/testdata/TTypeKindError.hs similarity index 100% rename from test/testdata/splice/TTypeKindError.hs rename to plugins/hls-splice-plugin/test/testdata/TTypeKindError.hs diff --git a/test/testdata/splice/TTypeKindError.hs.error b/plugins/hls-splice-plugin/test/testdata/TTypeKindError.hs.error similarity index 100% rename from test/testdata/splice/TTypeKindError.hs.error rename to plugins/hls-splice-plugin/test/testdata/TTypeKindError.hs.error diff --git a/test/testdata/splice/TTypeKindError.hs.expected b/plugins/hls-splice-plugin/test/testdata/TTypeKindError.hs.expected similarity index 100% rename from test/testdata/splice/TTypeKindError.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TTypeKindError.hs.expected diff --git a/test/testdata/splice/TTypeTypeError.hs b/plugins/hls-splice-plugin/test/testdata/TTypeTypeError.hs similarity index 100% rename from test/testdata/splice/TTypeTypeError.hs rename to plugins/hls-splice-plugin/test/testdata/TTypeTypeError.hs diff --git a/test/testdata/splice/TTypeTypeError.hs.expected b/plugins/hls-splice-plugin/test/testdata/TTypeTypeError.hs.expected similarity index 100% rename from test/testdata/splice/TTypeTypeError.hs.expected rename to plugins/hls-splice-plugin/test/testdata/TTypeTypeError.hs.expected diff --git a/test/testdata/splice/hie.yaml b/plugins/hls-splice-plugin/test/testdata/hie.yaml similarity index 100% rename from test/testdata/splice/hie.yaml rename to plugins/hls-splice-plugin/test/testdata/hie.yaml diff --git a/test/functional/Command.hs b/test/functional/Command.hs index 5fb20c43c1..871a2d82ba 100644 --- a/test/functional/Command.hs +++ b/test/functional/Command.hs @@ -7,6 +7,7 @@ import qualified Data.Text as T import Language.LSP.Types as LSP import Language.LSP.Types.Lens as LSP import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "commands" [ diff --git a/test/functional/Completion.hs b/test/functional/Completion.hs index 92b7883bf5..2e665ce995 100644 --- a/test/functional/Completion.hs +++ b/test/functional/Completion.hs @@ -8,6 +8,7 @@ import qualified Data.Text as T import Ide.Plugin.Config (maxCompletions) import Language.LSP.Types.Lens hiding (applyEdit) import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "completions" [ diff --git a/test/functional/Config.hs b/test/functional/Config.hs index d5a4c17cb5..b6623ed9ea 100644 --- a/test/functional/Config.hs +++ b/test/functional/Config.hs @@ -12,6 +12,7 @@ import Language.LSP.Test as Test import qualified Language.LSP.Types.Lens as L import System.FilePath (()) import Test.Hls +import Test.Hls.Command {-# ANN module ("HLint: ignore Reduce duplication"::String) #-} diff --git a/test/functional/Deferred.hs b/test/functional/Deferred.hs index ace17a4cbe..02239701e9 100644 --- a/test/functional/Deferred.hs +++ b/test/functional/Deferred.hs @@ -9,6 +9,7 @@ import Control.Lens hiding (List) import Language.LSP.Types.Lens hiding (id, message) -- import qualified Language.LSP.Types.Lens as LSP import Test.Hls +import Test.Hls.Command tests :: TestTree diff --git a/test/functional/Definition.hs b/test/functional/Definition.hs index 67beba9e56..85ed8b876d 100644 --- a/test/functional/Definition.hs +++ b/test/functional/Definition.hs @@ -4,6 +4,7 @@ import Control.Lens import Language.LSP.Types.Lens import System.Directory import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "definitions" [ diff --git a/test/functional/Diagnostic.hs b/test/functional/Diagnostic.hs index 3966de9545..bfe304d99e 100644 --- a/test/functional/Diagnostic.hs +++ b/test/functional/Diagnostic.hs @@ -8,6 +8,7 @@ import qualified Data.Default import Ide.Plugin.Config import qualified Language.LSP.Types.Lens as LSP import Test.Hls +import Test.Hls.Command -- --------------------------------------------------------------------- diff --git a/test/functional/Format.hs b/test/functional/Format.hs index 4b2c201a1e..339e849e6a 100644 --- a/test/functional/Format.hs +++ b/test/functional/Format.hs @@ -12,6 +12,7 @@ import Language.LSP.Test import Language.LSP.Types import qualified Language.LSP.Types.Lens as LSP import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "format document" [ diff --git a/test/functional/FunctionalCodeAction.hs b/test/functional/FunctionalCodeAction.hs index 358f9d9768..00ccc42832 100644 --- a/test/functional/FunctionalCodeAction.hs +++ b/test/functional/FunctionalCodeAction.hs @@ -22,6 +22,7 @@ import Test.Hspec.Expectations import System.FilePath (()) import System.IO.Extra (withTempDir) +import Test.Hls.Command {-# ANN module ("HLint: ignore Reduce duplication"::String) #-} diff --git a/test/functional/FunctionalLiquid.hs b/test/functional/FunctionalLiquid.hs index 99a36eb607..77a553f7ad 100644 --- a/test/functional/FunctionalLiquid.hs +++ b/test/functional/FunctionalLiquid.hs @@ -7,6 +7,8 @@ import Data.Aeson import Ide.Plugin.Config import Language.LSP.Types.Lens as LSP hiding (contents) import Test.Hls +import Test.Hls.Command + -- --------------------------------------------------------------------- tests :: TestTree diff --git a/test/functional/HaddockComments.hs b/test/functional/HaddockComments.hs index 6b3b0cdff3..cb83a237b9 100644 --- a/test/functional/HaddockComments.hs +++ b/test/functional/HaddockComments.hs @@ -18,6 +18,7 @@ import Data.Text (Text) import Data.Text.Encoding (encodeUtf8) import System.FilePath ((<.>), ()) import Test.Hls +import Test.Hls.Command tests :: TestTree tests = diff --git a/test/functional/HieBios.hs b/test/functional/HieBios.hs index 11f5163cd4..1ab9f2837e 100644 --- a/test/functional/HieBios.hs +++ b/test/functional/HieBios.hs @@ -7,6 +7,7 @@ import qualified Data.Text as T import qualified Language.LSP.Types.Lens as L import System.FilePath (()) import Test.Hls +import Test.Hls.Command tests :: TestTree diff --git a/test/functional/Highlight.hs b/test/functional/Highlight.hs index ec518d956e..fcc8e8ea04 100644 --- a/test/functional/Highlight.hs +++ b/test/functional/Highlight.hs @@ -2,6 +2,7 @@ module Highlight (tests) where import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "highlight" [ diff --git a/test/functional/Main.hs b/test/functional/Main.hs index 2ae16e5f37..7c43327e4e 100644 --- a/test/functional/Main.hs +++ b/test/functional/Main.hs @@ -1,6 +1,5 @@ module Main where -import Class import Command import Completion import Config @@ -18,7 +17,6 @@ import ModuleName import Progress import Reference import Rename -import Splice import Symbol import Test.Hls import TypeDefinition @@ -27,8 +25,7 @@ main :: IO () main = defaultTestRunner $ testGroup "haskell-language-server" - [ Class.tests - , Command.tests + [ Command.tests , Completion.tests , Config.tests , Deferred.tests @@ -46,6 +43,5 @@ main = defaultTestRunner , Rename.tests , Symbol.tests , TypeDefinition.tests - , Splice.tests , HaddockComments.tests ] diff --git a/test/functional/ModuleName.hs b/test/functional/ModuleName.hs index 077d4cb35b..7c5b6130ba 100644 --- a/test/functional/ModuleName.hs +++ b/test/functional/ModuleName.hs @@ -7,9 +7,10 @@ module ModuleName ) where -import qualified Data.Text.IO as T -import System.FilePath ((<.>), ()) +import qualified Data.Text.IO as T +import System.FilePath ((<.>), ()) import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup diff --git a/test/functional/Progress.hs b/test/functional/Progress.hs index 3e5c6d186f..58e0e8bbe8 100644 --- a/test/functional/Progress.hs +++ b/test/functional/Progress.hs @@ -18,6 +18,7 @@ import Language.LSP.Types.Capabilities import qualified Language.LSP.Types.Lens as L import System.FilePath (()) import Test.Hls +import Test.Hls.Command tests :: TestTree tests = diff --git a/test/functional/Reference.hs b/test/functional/Reference.hs index 994e1b6082..e3304fbec1 100644 --- a/test/functional/Reference.hs +++ b/test/functional/Reference.hs @@ -5,6 +5,7 @@ import Data.Coerce import Data.List import Language.LSP.Types.Lens import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "references" [ diff --git a/test/functional/Rename.hs b/test/functional/Rename.hs index aa6272e2a4..08de8a63d9 100644 --- a/test/functional/Rename.hs +++ b/test/functional/Rename.hs @@ -2,6 +2,7 @@ module Rename (tests) where import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "rename" [ diff --git a/test/functional/Symbol.hs b/test/functional/Symbol.hs index 78fae0bf4b..965d30d4c1 100644 --- a/test/functional/Symbol.hs +++ b/test/functional/Symbol.hs @@ -7,6 +7,7 @@ import Language.LSP.Test as Test import Language.LSP.Types.Capabilities import qualified Language.LSP.Types.Lens as L import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "document symbols" [ diff --git a/test/functional/TypeDefinition.hs b/test/functional/TypeDefinition.hs index b56198c62d..1bba39440b 100644 --- a/test/functional/TypeDefinition.hs +++ b/test/functional/TypeDefinition.hs @@ -3,6 +3,7 @@ module TypeDefinition (tests) where import Data.Tuple.Extra (first3) import System.FilePath (()) import Test.Hls +import Test.Hls.Command tests :: TestTree tests = testGroup "type definitions" [ diff --git a/test/testdata/splice/.gitignore b/test/testdata/splice/.gitignore deleted file mode 100644 index 229336d2f3..0000000000 --- a/test/testdata/splice/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!hie.yaml diff --git a/test/utils/Test/Hls/Command.hs b/test/utils/Test/Hls/Command.hs new file mode 100644 index 0000000000..656aca1beb --- /dev/null +++ b/test/utils/Test/Hls/Command.hs @@ -0,0 +1,32 @@ +module Test.Hls.Command + ( hlsCommand, + hlsCommandExamplePlugin, + hlsCommandVomit, + logFilePath, + ) +where + +import Data.Maybe (fromMaybe) +import System.Environment (lookupEnv) +import System.IO.Unsafe (unsafePerformIO) +import Test.Hls + +logFilePath :: String +logFilePath = "hls-" ++ show ghcVersion ++ ".log" + +-- | The command to execute the version of hls for the current compiler. +-- +-- Both @stack test@ and @cabal new-test@ setup the environment so @hls@ is +-- on PATH. Cabal seems to respond to @build-tool-depends@ specifically while +-- stack just puts all project executables on PATH. +hlsCommand :: String +{-# NOINLINE hlsCommand #-} +hlsCommand = unsafePerformIO $ do + testExe <- fromMaybe "haskell-language-server" <$> lookupEnv "HLS_TEST_EXE" + pure $ testExe ++ " --lsp -d -j2 -l test-logs/" ++ logFilePath + +hlsCommandVomit :: String +hlsCommandVomit = hlsCommand ++ " --vomit" + +hlsCommandExamplePlugin :: String +hlsCommandExamplePlugin = hlsCommand ++ " --example" From e6bb8c53eccf49fd5b71064e4eecd539b9c011f6 Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 14:27:45 +0800 Subject: [PATCH 3/9] Haddock comments plugin --- haskell-language-server.cabal | 1 - .../hls-haddock-comments-plugin.cabal | 72 ++++++++++++++----- .../hls-haddock-comments-plugin/test/Main.hs | 16 ++--- .../test/Server.hs | 18 +++++ .../test/testdata}/ConstFunction.hs | 0 .../testdata}/HigherRankFunction.expected.hs | 0 .../test/testdata}/HigherRankFunction.hs | 0 .../testdata}/KindSigFunction.expected.hs | 0 .../test/testdata}/KindSigFunction.hs | 0 .../MultivariateFunction.expected.hs | 0 .../test/testdata}/MultivariateFunction.hs | 0 .../test/testdata}/QualFunction.expected.hs | 0 .../test/testdata}/QualFunction.hs | 0 .../test/testdata}/Record.expected.hs | 0 .../test/testdata}/Record.hs | 0 .../test/testdata}/StaleFunction.hs | 0 .../test/testdata}/StaleRecord.hs | 0 17 files changed, 79 insertions(+), 28 deletions(-) rename test/functional/HaddockComments.hs => plugins/hls-haddock-comments-plugin/test/Main.hs (88%) create mode 100644 plugins/hls-haddock-comments-plugin/test/Server.hs rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/ConstFunction.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/HigherRankFunction.expected.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/HigherRankFunction.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/KindSigFunction.expected.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/KindSigFunction.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/MultivariateFunction.expected.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/MultivariateFunction.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/QualFunction.expected.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/QualFunction.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/Record.expected.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/Record.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/StaleFunction.hs (100%) rename {test/testdata/haddockComments => plugins/hls-haddock-comments-plugin/test/testdata}/StaleRecord.hs (100%) diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 082f5cbc4c..b2d5825965 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -416,7 +416,6 @@ test-suite func-test Rename Symbol TypeDefinition - HaddockComments Test.Hls.Command default-extensions: OverloadedStrings diff --git a/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal b/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal index 0a0401a351..78f4d3a70d 100644 --- a/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal +++ b/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal @@ -1,33 +1,67 @@ -cabal-version: 2.2 -name: hls-haddock-comments-plugin -version: 1.0.0.0 -synopsis: Haddock comments plugin for Haskell Language Server +cabal-version: 2.4 +name: hls-haddock-comments-plugin +version: 1.0.0.0 +synopsis: Haddock comments plugin for Haskell Language Server description: Please see the README on GitHub at -license: Apache-2.0 -license-file: LICENSE -author: Potato Hatsue -maintainer: berberman@yandex.com -category: Development -build-type: Simple -homepage: https://github.com/haskell/haskell-language-server -bug-reports: https://github.com/haskell/haskell-language-server/issues +license: Apache-2.0 +license-file: LICENSE +author: Potato Hatsue +maintainer: berberman@yandex.com +category: Development +build-type: Simple +homepage: https://github.com/haskell/haskell-language-server +bug-reports: https://github.com/haskell/haskell-language-server/issues +extra-source-files: + LICENSE + test/testdata/**/*.hs library - exposed-modules: Ide.Plugin.HaddockComments - hs-source-dirs: src - ghc-options: -Wall -Wno-name-shadowing -Wredundant-constraints -Wno-unticked-promoted-constructors + exposed-modules: Ide.Plugin.HaddockComments + hs-source-dirs: src + ghc-options: + -Wall -Wno-name-shadowing -Wredundant-constraints + -Wno-unticked-promoted-constructors + build-depends: - , base >=4.12 && <5 + , base >=4.12 && <5 , containers , ghc , ghc-exactprint - , ghcide ^>= 1.1.0.0 + , ghcide ^>=1.1.0.0 + , hls-plugin-api >=1.0 && <1.2 , lsp-types - , hls-plugin-api >= 1.0 && < 1.2 , text , unordered-containers + default-language: Haskell2010 + default-extensions: + DataKinds + TypeOperators + +executable test-server default-language: Haskell2010 - default-extensions: DataKinds, TypeOperators + build-depends: + , base + , data-default + , ghcide + , hls-haddock-comments-plugin + , hls-plugin-api + + main-is: Server.hs + hs-source-dirs: test + ghc-options: -threaded + +test-suite tests + type: exitcode-stdio-1.0 + default-language: Haskell2010 + build-tool-depends: hls-haddock-comments-plugin:test-server -any + hs-source-dirs: test + main-is: Main.hs + build-depends: + , base + , bytestring + , filepath + , hls-test-utils + , text diff --git a/test/functional/HaddockComments.hs b/plugins/hls-haddock-comments-plugin/test/Main.hs similarity index 88% rename from test/functional/HaddockComments.hs rename to plugins/hls-haddock-comments-plugin/test/Main.hs index cb83a237b9..b1ad5d8454 100644 --- a/test/functional/HaddockComments.hs +++ b/plugins/hls-haddock-comments-plugin/test/Main.hs @@ -6,8 +6,8 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE ViewPatterns #-} -module HaddockComments - ( tests, +module Main + ( main, ) where @@ -18,7 +18,9 @@ import Data.Text (Text) import Data.Text.Encoding (encodeUtf8) import System.FilePath ((<.>), ()) import Test.Hls -import Test.Hls.Command + +main :: IO () +main = defaultTestRunner tests tests :: TestTree tests = @@ -36,9 +38,8 @@ tests = goldenTest :: FilePath -> GenCommentsType -> Int -> Int -> TestTree goldenTest fp (toTitle -> expectedTitle) l c = goldenGitDiff (fp <> " (golden)") goldenFilePath $ - runSession hlsCommand fullCaps haddockCommentsPath $ do + runSession testCommand fullCaps haddockCommentsPath $ do doc <- openDoc hsFilePath "haskell" - _ <- waitForDiagnostics actions <- getCodeActions doc (Range (Position l c) (Position l $ succ c)) case find ((== Just expectedTitle) . caTitle) actions of Just (InR x) -> do @@ -51,9 +52,8 @@ goldenTest fp (toTitle -> expectedTitle) l c = goldenGitDiff (fp <> " (golden)") expectedNothing :: FilePath -> GenCommentsType -> Int -> Int -> TestTree expectedNothing fp (toTitle -> expectedTitle) l c = testCase fp $ - runSession hlsCommand fullCaps haddockCommentsPath $ do + runSession testCommand fullCaps haddockCommentsPath $ do doc <- openDoc (fp <.> "hs") "haskell" - _ <- waitForDiagnostics titles <- mapMaybe caTitle <$> getCodeActions doc (Range (Position l c) (Position l $ succ c)) liftIO $ expectedTitle `notElem` titles @? "Unexpected CodeAction" @@ -68,5 +68,5 @@ caTitle (InR CodeAction {_title}) = Just _title caTitle _ = Nothing haddockCommentsPath :: String -haddockCommentsPath = "test" "testdata" "haddockComments" +haddockCommentsPath = "test" "testdata" diff --git a/plugins/hls-haddock-comments-plugin/test/Server.hs b/plugins/hls-haddock-comments-plugin/test/Server.hs new file mode 100644 index 0000000000..1bb10f0abd --- /dev/null +++ b/plugins/hls-haddock-comments-plugin/test/Server.hs @@ -0,0 +1,18 @@ + +{-# LANGUAGE OverloadedStrings #-} +module Main(main) where + +import Data.Default +import Development.IDE.Main +import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide +import Ide.Plugin.Config +import qualified Ide.Plugin.HaddockComments as HaddockComments +import Ide.PluginUtils + +main :: IO () +main = defaultMain def + { argsHlsPlugins = pluginDescToIdePlugins $ + [ HaddockComments.descriptor "haddockComments" + ] <> + Ghcide.descriptors + } diff --git a/test/testdata/haddockComments/ConstFunction.hs b/plugins/hls-haddock-comments-plugin/test/testdata/ConstFunction.hs similarity index 100% rename from test/testdata/haddockComments/ConstFunction.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/ConstFunction.hs diff --git a/test/testdata/haddockComments/HigherRankFunction.expected.hs b/plugins/hls-haddock-comments-plugin/test/testdata/HigherRankFunction.expected.hs similarity index 100% rename from test/testdata/haddockComments/HigherRankFunction.expected.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/HigherRankFunction.expected.hs diff --git a/test/testdata/haddockComments/HigherRankFunction.hs b/plugins/hls-haddock-comments-plugin/test/testdata/HigherRankFunction.hs similarity index 100% rename from test/testdata/haddockComments/HigherRankFunction.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/HigherRankFunction.hs diff --git a/test/testdata/haddockComments/KindSigFunction.expected.hs b/plugins/hls-haddock-comments-plugin/test/testdata/KindSigFunction.expected.hs similarity index 100% rename from test/testdata/haddockComments/KindSigFunction.expected.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/KindSigFunction.expected.hs diff --git a/test/testdata/haddockComments/KindSigFunction.hs b/plugins/hls-haddock-comments-plugin/test/testdata/KindSigFunction.hs similarity index 100% rename from test/testdata/haddockComments/KindSigFunction.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/KindSigFunction.hs diff --git a/test/testdata/haddockComments/MultivariateFunction.expected.hs b/plugins/hls-haddock-comments-plugin/test/testdata/MultivariateFunction.expected.hs similarity index 100% rename from test/testdata/haddockComments/MultivariateFunction.expected.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/MultivariateFunction.expected.hs diff --git a/test/testdata/haddockComments/MultivariateFunction.hs b/plugins/hls-haddock-comments-plugin/test/testdata/MultivariateFunction.hs similarity index 100% rename from test/testdata/haddockComments/MultivariateFunction.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/MultivariateFunction.hs diff --git a/test/testdata/haddockComments/QualFunction.expected.hs b/plugins/hls-haddock-comments-plugin/test/testdata/QualFunction.expected.hs similarity index 100% rename from test/testdata/haddockComments/QualFunction.expected.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/QualFunction.expected.hs diff --git a/test/testdata/haddockComments/QualFunction.hs b/plugins/hls-haddock-comments-plugin/test/testdata/QualFunction.hs similarity index 100% rename from test/testdata/haddockComments/QualFunction.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/QualFunction.hs diff --git a/test/testdata/haddockComments/Record.expected.hs b/plugins/hls-haddock-comments-plugin/test/testdata/Record.expected.hs similarity index 100% rename from test/testdata/haddockComments/Record.expected.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/Record.expected.hs diff --git a/test/testdata/haddockComments/Record.hs b/plugins/hls-haddock-comments-plugin/test/testdata/Record.hs similarity index 100% rename from test/testdata/haddockComments/Record.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/Record.hs diff --git a/test/testdata/haddockComments/StaleFunction.hs b/plugins/hls-haddock-comments-plugin/test/testdata/StaleFunction.hs similarity index 100% rename from test/testdata/haddockComments/StaleFunction.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/StaleFunction.hs diff --git a/test/testdata/haddockComments/StaleRecord.hs b/plugins/hls-haddock-comments-plugin/test/testdata/StaleRecord.hs similarity index 100% rename from test/testdata/haddockComments/StaleRecord.hs rename to plugins/hls-haddock-comments-plugin/test/testdata/StaleRecord.hs From 37ce9db461f544e861e6cd43bd89fdf359d99ca8 Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 14:37:45 +0800 Subject: [PATCH 4/9] Update github actions --- .github/workflows/test.yml | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44d0d90e3e..51c31323ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -131,27 +131,30 @@ jobs: # instances to be spun up for the poor github actions runner to handle run: cabal test wrapper-test --test-options="-j1" || cabal test wrapper-test --test-options="-j1" || cabal test wrapper-test --test-options="-j1" - - name: Test hls-tactics-plugin test suite + - name: Test hls-brittany-plugin if: ${{ matrix.test }} - run: LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-tactics-plugin --test-options="-j1" + run: cabal test hls-brittany-plugin || cabal test hls-brittany-plugin --test-options="-j1" - - name: Test brittany plugin + - name: Test hls-class-plugin if: ${{ matrix.test }} - env: - HLS_TEST_EXE: hls - HLS_WRAPPER_TEST_EXE: hls-wrapper - run: cabal test hls-brittany-plugin || cabal test hls-brittany-plugin --test-options="-j1" + run: cabal test hls-class-plugin || cabal test hls-class-plugin --test-options="-j1" - - name: Test stylish-haskell plugin + - name: Test hls-eval-plugin + if: ${{ matrix.test }} + run: cabal test hls-eval-plugin --test-options="-j1 --rerun" || cabal test hls-eval-plugin --test-options="-j1 --rerun" + + - name: Test hls-haddock-comments-plugin + if: ${{ matrix.test }} + run: cabal test hls-haddock-comments-plugin || cabal test hls-haddock-comments-plugin --test-options="-j1" + + - name: Test hls-splice-plugin + if: ${{ matrix.test }} + run: cabal test hls-splice-plugin || cabal test hls-splice-plugin --test-options="-j1" + + - name: Test hls-stylish-haskell-plugin if: ${{ matrix.test }} - env: - HLS_TEST_EXE: hls - HLS_WRAPPER_TEST_EXE: hls-wrapper run: cabal test hls-stylish-haskell-plugin || cabal test hls-stylish-haskell-plugin --test-options="-j1" - - name: Test eval plugin + - name: Test hls-tactics-plugin test suite if: ${{ matrix.test }} - env: - HLS_TEST_EXE: hls - HLS_WRAPPER_TEST_EXE: hls-wrapper - run: cabal test hls-eval-plugin || cabal test hls-eval-plugin --test-options="-j1" + run: LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-tactics-plugin --test-options="-j1" From 750f82f07bc78f25d8f7f7f33d6abf235eb6f41e Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 14:58:51 +0800 Subject: [PATCH 5/9] Remove invalid import --- test/functional/Main.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/functional/Main.hs b/test/functional/Main.hs index 7c43327e4e..660eee674d 100644 --- a/test/functional/Main.hs +++ b/test/functional/Main.hs @@ -10,7 +10,6 @@ import Format import FunctionalBadProject import FunctionalCodeAction import FunctionalLiquid -import HaddockComments import HieBios import Highlight import ModuleName @@ -43,5 +42,4 @@ main = defaultTestRunner , Rename.tests , Symbol.tests , TypeDefinition.tests - , HaddockComments.tests ] From 5bd53550d608c6a32bf7d3629b342c49adf0f67b Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 15:34:03 +0800 Subject: [PATCH 6/9] Bump up specification version of package description to 2.4 --- hls-plugin-api/hls-plugin-api.cabal | 2 +- hls-test-utils/hls-test-utils.cabal | 2 +- plugins/hls-class-plugin/hls-class-plugin.cabal | 2 +- .../hls-haddock-comments-plugin.cabal | 2 +- plugins/hls-splice-plugin/hls-splice-plugin.cabal | 3 ++- plugins/hls-tactics-plugin/hls-tactics-plugin.cabal | 4 ++-- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hls-plugin-api/hls-plugin-api.cabal b/hls-plugin-api/hls-plugin-api.cabal index 6c6f48319b..ef91e712e4 100644 --- a/hls-plugin-api/hls-plugin-api.cabal +++ b/hls-plugin-api/hls-plugin-api.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.2 +cabal-version: 2.4 name: hls-plugin-api version: 1.1.0.0 synopsis: Haskell Language Server API for plugin communication diff --git a/hls-test-utils/hls-test-utils.cabal b/hls-test-utils/hls-test-utils.cabal index bf99a88ee7..8e9dc107ff 100644 --- a/hls-test-utils/hls-test-utils.cabal +++ b/hls-test-utils/hls-test-utils.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.2 +cabal-version: 2.4 name: hls-test-utils version: 1.0.0.0 synopsis: Utilities used in the tests of Haskell Language Server diff --git a/plugins/hls-class-plugin/hls-class-plugin.cabal b/plugins/hls-class-plugin/hls-class-plugin.cabal index 2011ae0cad..45433bd2a0 100644 --- a/plugins/hls-class-plugin/hls-class-plugin.cabal +++ b/plugins/hls-class-plugin/hls-class-plugin.cabal @@ -18,7 +18,7 @@ category: Development build-type: Simple extra-source-files: LICENSE - test/testdata/**/*.hs + test/testdata/*.hs library exposed-modules: Ide.Plugin.Class diff --git a/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal b/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal index 78f4d3a70d..d799118cc1 100644 --- a/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal +++ b/plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal @@ -15,7 +15,7 @@ homepage: https://github.com/haskell/haskell-language-server bug-reports: https://github.com/haskell/haskell-language-server/issues extra-source-files: LICENSE - test/testdata/**/*.hs + test/testdata/*.hs library exposed-modules: Ide.Plugin.HaddockComments diff --git a/plugins/hls-splice-plugin/hls-splice-plugin.cabal b/plugins/hls-splice-plugin/hls-splice-plugin.cabal index 94c9a52606..fbefeebda2 100644 --- a/plugins/hls-splice-plugin/hls-splice-plugin.cabal +++ b/plugins/hls-splice-plugin/hls-splice-plugin.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.2 +cabal-version: 2.4 name: hls-splice-plugin version: 1.0.0.0 synopsis: @@ -20,6 +20,7 @@ build-type: Simple extra-source-files: LICENSE test/testdata/*.expected + test/testdata/*.error test/testdata/*.hs test/testdata/*.yaml diff --git a/plugins/hls-tactics-plugin/hls-tactics-plugin.cabal b/plugins/hls-tactics-plugin/hls-tactics-plugin.cabal index ff9a28ce47..357883a479 100644 --- a/plugins/hls-tactics-plugin/hls-tactics-plugin.cabal +++ b/plugins/hls-tactics-plugin/hls-tactics-plugin.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.2 +cabal-version: 2.4 category: Development name: hls-tactics-plugin version: 1.0.0.0 @@ -17,7 +17,7 @@ extra-source-files: test/golden/*.cabal test/golden/*.yaml test/golden/*.hs - test/golden/*.hs.expected + test/golden/*.expected flag pedantic From b90eb36e1edb791509145ebf7afee1b1181d581e Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 16:09:17 +0800 Subject: [PATCH 7/9] Fix hls.cabal --- haskell-language-server.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index b2d5825965..2e3c50f9e0 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -27,7 +27,6 @@ extra-source-files: test/testdata/**/*.h test/testdata/**/*.hs test/testdata/**/*.expected - test/testdata/**/*.error flag pedantic description: Enable -Werror From 7cee7b32e295dc8844813244afb5b97fb314edfc Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 17:32:29 +0800 Subject: [PATCH 8/9] Remove the build of eval plugin's testdata from circle ci --- .circleci/config.yml | 8 -------- plugins/hls-eval-plugin/test/testdata/hie-cabal.yaml | 4 ---- plugins/hls-eval-plugin/test/testdata/hie-stack.yaml | 4 ---- plugins/hls-eval-plugin/test/testdata/stack.yaml | 4 ---- 4 files changed, 20 deletions(-) delete mode 100644 plugins/hls-eval-plugin/test/testdata/hie-cabal.yaml delete mode 100644 plugins/hls-eval-plugin/test/testdata/hie-stack.yaml delete mode 100644 plugins/hls-eval-plugin/test/testdata/stack.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml index 715de0f01f..760943caa2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,14 +52,6 @@ defaults: &defaults - ~/build/.stack-work - ~/build/ghcide/.stack-work - - run: - name: Setup stack eval hie.html - command: cp plugins/hls-eval-plugin/test/testdata/hie-stack.yaml plugins/hls-eval-plugin/test/testdata/hie.yaml - - - run: - name: Setup stack eval stack.html - command: grep '^resolver:\|^compiler:' stack-build.txt > plugins/hls-eval-plugin/test/testdata/stack.yaml - - run: name: Build including tests command: stack --stack-yaml=${STACK_FILE} test --no-run-tests diff --git a/plugins/hls-eval-plugin/test/testdata/hie-cabal.yaml b/plugins/hls-eval-plugin/test/testdata/hie-cabal.yaml deleted file mode 100644 index 7251e586cd..0000000000 --- a/plugins/hls-eval-plugin/test/testdata/hie-cabal.yaml +++ /dev/null @@ -1,4 +0,0 @@ -cradle: - cabal: - - path: "././" - component: "lib:test" diff --git a/plugins/hls-eval-plugin/test/testdata/hie-stack.yaml b/plugins/hls-eval-plugin/test/testdata/hie-stack.yaml deleted file mode 100644 index 59c739536a..0000000000 --- a/plugins/hls-eval-plugin/test/testdata/hie-stack.yaml +++ /dev/null @@ -1,4 +0,0 @@ -cradle: - stack: - - path: "././" - component: "test:lib" diff --git a/plugins/hls-eval-plugin/test/testdata/stack.yaml b/plugins/hls-eval-plugin/test/testdata/stack.yaml deleted file mode 100644 index ca2bb68516..0000000000 --- a/plugins/hls-eval-plugin/test/testdata/stack.yaml +++ /dev/null @@ -1,4 +0,0 @@ -resolver: lts-14.27 # Last 8.6.5 - -packages: - - . From be609f030526e3e3a89da5d3800c2d894c4f04bd Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Wed, 24 Mar 2021 17:37:49 +0800 Subject: [PATCH 9/9] Limit the parallelism of building test suites in circle ci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 760943caa2..b9702220fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,7 +38,7 @@ defaults: &defaults - run: name: Build Testsuite without running it - command: stack --stack-yaml=${STACK_FILE} build --test --no-run-tests + command: stack -j 1 --stack-yaml=${STACK_FILE} build --test --no-run-tests no_output_timeout: 30m - store_artifacts: