From b3b9534b939341ec9355bfbad4e49f92b2b83de1 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 08:29:28 +0100 Subject: [PATCH 01/15] Bump ghcide to incoming 0.6 --- ghcide | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghcide b/ghcide index 9b8aaf9b06..6a7790a549 160000 --- a/ghcide +++ b/ghcide @@ -1 +1 @@ -Subproject commit 9b8aaf9b06846571cc0b5d46680e686e4f9153a3 +Subproject commit 6a7790a54963d50c605ede0ca1609a4a713c6988 From 7d5e7924b17f4867df6bb2a5a2d21b05c5d8c916 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 09:41:06 +0100 Subject: [PATCH 02/15] Update hackage index to 2020-12-09T06:57:58Z --- cabal.project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal.project b/cabal.project index 4d64265352..d17c232452 100644 --- a/cabal.project +++ b/cabal.project @@ -25,6 +25,6 @@ package ghcide write-ghc-environment-files: never -index-state: 2020-12-03T03:58:05Z +index-state: 2020-12-09T06:57:58Z allow-newer: data-tree-print:base From b24f61026a01725b5939875307f1a4e3eca794d6 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 09:41:25 +0100 Subject: [PATCH 03/15] Bump up ghcide lower bound to 0.6 --- haskell-language-server.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 5391928d54..b4611c77ce 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -59,10 +59,10 @@ library , containers , data-default , ghc - , ghcide >=0.5 + , ghcide >=0.6 , gitrev , haskell-lsp ^>=0.22 - , hie-bios >=0.6.1 && <0.8 + , hie-bios >=0.7.1 && <0.8 , hls-plugin-api >=0.5 , hslogger , optparse-applicative From dd24c61f248b56f1e5630a401ad208bbc61ff413 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 09:41:50 +0100 Subject: [PATCH 04/15] Update stack config to use ghcide-0.6 --- stack-8.10.1.yaml | 11 +++++++---- stack-8.10.2.yaml | 9 +++++---- stack-8.6.4.yaml | 9 +++++++-- stack-8.6.5.yaml | 9 +++++++-- stack-8.8.2.yaml | 10 +++++++--- stack-8.8.3.yaml | 8 ++++++-- stack-8.8.4.yaml | 11 +++++++---- stack.yaml | 9 +++++++-- 8 files changed, 53 insertions(+), 23 deletions(-) diff --git a/stack-8.10.1.yaml b/stack-8.10.1.yaml index 08b8638274..adf8a6fdb0 100644 --- a/stack-8.10.1.yaml +++ b/stack-8.10.1.yaml @@ -18,19 +18,21 @@ extra-deps: commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c - Cabal-3.0.2.0 - clock-0.7.2 -- data-tree-print-0.1.0.2 +- data-tree-print-0.1.0.2@rev:2 - floskell-0.10.4 - fourmolu-0.3.0.0 - ghc-lib-8.10.2.20200916 - ghc-lib-parser-8.10.2.20200916 +- heapsize-0.3.0 - hie-bios-0.7.1 -- hlint-3.2 +- hlint-3.2.3 - HsYAML-aeson-0.2.0.0@rev:2 - implicit-hie-cradle-0.3.0.2 - implicit-hie-0.1.2.5 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 -- opentelemetry-0.4.2 +- opentelemetry-0.6.1 +- opentelemetry-extra-0.6.1 - ormolu-0.1.4.1 - refinery-0.3.0.0 - retrie-0.1.1.1 @@ -44,7 +46,8 @@ flags: retrie: BuildExecutable: false -# for data-tree-print's bounds on base (>=4.8 && <4.14); using base-4.14.0.0. +# for brittany's bounds on strict (>=0.3.2 && <0.4); using strict-0.4.0.1. +# https://github.com/lspitzner/brittany/issues/328 allow-newer: true nix: diff --git a/stack-8.10.2.yaml b/stack-8.10.2.yaml index 4767dffd0f..25b04bee14 100644 --- a/stack-8.10.2.yaml +++ b/stack-8.10.2.yaml @@ -1,4 +1,4 @@ -resolver: nightly-2020-11-22 +resolver: nightly-2020-12-09 packages: - . @@ -18,14 +18,14 @@ extra-deps: commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c - Cabal-3.0.2.0 - clock-0.7.2 -- data-tree-print-0.1.0.2 +- data-tree-print-0.1.0.2@rev:2 - floskell-0.10.4 - fourmolu-0.3.0.0 +- heapsize-0.3.0 - implicit-hie-cradle-0.3.0.2 - implicit-hie-0.1.2.5 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 -- opentelemetry-0.4.2 - refinery-0.3.0.0 - retrie-0.1.1.1 - stylish-haskell-0.12.2.0 @@ -38,7 +38,8 @@ flags: retrie: BuildExecutable: false -# for data-tree-print's bounds on base (>=4.8 && <4.14); using base-4.14.0.0. +# for brittany's bounds on strict (>=0.3.2 && <0.4); using strict-0.4.0.1. +# https://github.com/lspitzner/brittany/issues/328 allow-newer: true nix: diff --git a/stack-8.6.4.yaml b/stack-8.6.4.yaml index fc1ab647f6..1232009d82 100644 --- a/stack-8.6.4.yaml +++ b/stack-8.6.4.yaml @@ -32,17 +32,21 @@ extra-deps: - fuzzy-0.1.0.0 # - ghcide-0.1.0 - ghc-check-0.5.0.1 +- ghc-events-0.13.0 - ghc-exactprint-0.6.3.2 - ghc-lib-8.10.2.20200916 - ghc-lib-parser-8.10.2.20200916 - ghc-lib-parser-ex-8.10.0.16 - ghc-source-gen-0.4.0.0 +- ghc-trace-events-0.1.2.1 - haddock-api-2.22.0@rev:1 - haddock-library-1.8.0 +- hashable-1.3.0.0 - haskell-lsp-0.22.0.0 - haskell-lsp-types-0.22.0.0 +- heapsize-0.3.0 - hie-bios-0.7.1 -- hlint-3.2 +- hlint-3.2.3 - HsYAML-0.2.1.0@rev:1 - HsYAML-aeson-0.2.0.0@rev:2 - implicit-hie-cradle-0.3.0.2 @@ -51,7 +55,8 @@ extra-deps: - lens-4.18 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 -- opentelemetry-0.4.2 +- opentelemetry-0.6.1 +- opentelemetry-extra-0.6.1 - optics-core-0.2 - optparse-applicative-0.15.1.0 - ormolu-0.1.4.1 diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml index 406b28464f..b48f225490 100644 --- a/stack-8.6.5.yaml +++ b/stack-8.6.5.yaml @@ -31,17 +31,21 @@ extra-deps: - fuzzy-0.1.0.0 # - ghcide-0.1.0 - ghc-check-0.5.0.1 +- ghc-events-0.13.0 - ghc-exactprint-0.6.3.2 - ghc-lib-8.10.2.20200916 - ghc-lib-parser-8.10.2.20200916 - ghc-lib-parser-ex-8.10.0.16 - ghc-source-gen-0.4.0.0 +- ghc-trace-events-0.1.2.1 - haddock-api-2.22.0@rev:1 - haddock-library-1.8.0 +- hashable-1.3.0.0 - haskell-lsp-0.22.0.0 - haskell-lsp-types-0.22.0.0 +- heapsize-0.3.0 - hie-bios-0.7.1 -- hlint-3.2 +- hlint-3.2.3 - HsYAML-0.2.1.0@rev:1 - HsYAML-aeson-0.2.0.0@rev:2 - implicit-hie-cradle-0.3.0.2 @@ -50,7 +54,8 @@ extra-deps: - lens-4.18 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 -- opentelemetry-0.4.2 +- opentelemetry-0.6.1 +- opentelemetry-extra-0.6.1 - optics-core-0.2 - optparse-applicative-0.15.1.0 - ormolu-0.1.4.1 diff --git a/stack-8.8.2.yaml b/stack-8.8.2.yaml index bbdbb4dbd8..78ba0c9c51 100644 --- a/stack-8.8.2.yaml +++ b/stack-8.8.2.yaml @@ -25,18 +25,21 @@ extra-deps: - extra-1.7.3 - floskell-0.10.4 - fourmolu-0.3.0.0 -# - ghcide-0.1.0 +# - ghcide-0.6.0 - ghc-check-0.5.0.1 +- ghc-events-0.13.0 - ghc-exactprint-0.6.3.2 - ghc-lib-8.10.2.20200916 - ghc-lib-parser-8.10.2.20200916 - ghc-lib-parser-ex-8.10.0.16 +- ghc-trace-events-0.1.2.1 - haddock-library-1.8.0 - haskell-lsp-0.22.0.0 - haskell-lsp-types-0.22.0.0 - haskell-src-exts-1.21.1 +- heapsize-0.3.0 - hie-bios-0.7.1 -- hlint-3.2 +- hlint-3.2.3 - hoogle-5.0.17.11 - hsimport-0.11.0 - HsYAML-0.2.1.0@rev:1 @@ -46,7 +49,8 @@ extra-deps: - implicit-hie-0.1.2.5 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 -- opentelemetry-0.4.2 +- opentelemetry-0.6.1 +- opentelemetry-extra-0.6.1 - ormolu-0.1.4.1 - refinery-0.3.0.0 - retrie-0.1.1.1 diff --git a/stack-8.8.3.yaml b/stack-8.8.3.yaml index e40078b1d8..66a3c589eb 100644 --- a/stack-8.8.3.yaml +++ b/stack-8.8.3.yaml @@ -25,13 +25,15 @@ extra-deps: - extra-1.7.3 - floskell-0.10.4 - fourmolu-0.3.0.0 -# - ghcide-0.1.0 +# - ghcide-0.6.0 - ghc-exactprint-0.6.3.2 - ghc-lib-8.10.2.20200916 - ghc-lib-parser-8.10.2.20200916 +- ghc-trace-events-0.1.2.1 - haskell-src-exts-1.21.1 +- heapsize-0.3.0 - hie-bios-0.7.1 -- hlint-3.2 +- hlint-3.2.3 - HsYAML-aeson-0.2.0.0@rev:2 - hoogle-5.0.17.11 - hsimport-0.11.0 @@ -40,6 +42,8 @@ extra-deps: - implicit-hie-0.1.2.5 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 +- opentelemetry-0.6.1 +- opentelemetry-extra-0.6.1 - ormolu-0.1.4.1 - refinery-0.3.0.0 - retrie-0.1.1.1 diff --git a/stack-8.8.4.yaml b/stack-8.8.4.yaml index 1a427717d0..f04a81e68c 100644 --- a/stack-8.8.4.yaml +++ b/stack-8.8.4.yaml @@ -1,4 +1,4 @@ -resolver: lts-16.23 +resolver: lts-16.25 packages: - . @@ -22,14 +22,15 @@ extra-deps: - cabal-plan-0.6.2.0 - clock-0.7.2 - constrained-dynamic-0.1.0.0 -- extra-1.7.3 - floskell-0.10.4 - fourmolu-0.3.0.0 -# - ghcide-0.1.0 +# - ghcide-0.6.0 - ghc-exactprint-0.6.3.2 +- ghc-trace-events-0.1.2.1 - haskell-src-exts-1.21.1 +- heapsize-0.3.0 - hie-bios-0.7.1 -- hlint-3.2 +- hlint-3.2.3 - HsYAML-aeson-0.2.0.0@rev:2 - hoogle-5.0.17.11 - hsimport-0.11.0 @@ -38,6 +39,8 @@ extra-deps: - implicit-hie-0.1.2.5 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 +- opentelemetry-0.6.1 +- opentelemetry-extra-0.6.1 - refinery-0.3.0.0 - retrie-0.1.1.1 - semigroups-0.18.5 diff --git a/stack.yaml b/stack.yaml index 406b28464f..5fcab7abd3 100644 --- a/stack.yaml +++ b/stack.yaml @@ -29,17 +29,21 @@ extra-deps: - floskell-0.10.4 - fourmolu-0.3.0.0 - fuzzy-0.1.0.0 -# - ghcide-0.1.0 +# - ghcide-0.6.0 - ghc-check-0.5.0.1 - ghc-exactprint-0.6.3.2 +- ghc-events-0.13.0 - ghc-lib-8.10.2.20200916 - ghc-lib-parser-8.10.2.20200916 - ghc-lib-parser-ex-8.10.0.16 - ghc-source-gen-0.4.0.0 +- ghc-trace-events-0.1.2.1 - haddock-api-2.22.0@rev:1 - haddock-library-1.8.0 +- hashable-1.3.0.0 - haskell-lsp-0.22.0.0 - haskell-lsp-types-0.22.0.0 +- heapsize-0.3.0 - hie-bios-0.7.1 - hlint-3.2 - HsYAML-0.2.1.0@rev:1 @@ -50,7 +54,8 @@ extra-deps: - lens-4.18 - lsp-test-0.11.0.6 - monad-dijkstra-0.1.1.2 -- opentelemetry-0.4.2 +- opentelemetry-0.6.1 +- opentelemetry-extra-0.6.1 - optics-core-0.2 - optparse-applicative-0.15.1.0 - ormolu-0.1.4.1 From d776eccf512ce10572c09eb416f697e04b06696c Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 13:40:36 +0100 Subject: [PATCH 05/15] Use definitive ghcide-0.6 --- ghcide | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghcide b/ghcide index 6a7790a549..baafe2cb82 160000 --- a/ghcide +++ b/ghcide @@ -1 +1 @@ -Subproject commit 6a7790a54963d50c605ede0ca1609a4a713c6988 +Subproject commit baafe2cb82215f992ded3e3c1bd03507553aae86 From a6b72fca83f7a9bb5d93caa6a4a49b6dbacd26d2 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 13:42:04 +0100 Subject: [PATCH 06/15] Leverage new ghcide loading options --- exe/Wrapper.hs | 5 +++-- haskell-language-server.cabal | 2 +- src/Ide/Main.hs | 7 +++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/exe/Wrapper.hs b/exe/Wrapper.hs index 61dc26cd99..8a0c452be1 100644 --- a/exe/Wrapper.hs +++ b/exe/Wrapper.hs @@ -7,7 +7,8 @@ import Control.Monad.Extra import Data.Foldable import Data.List import Data.Void -import HIE.Bios +import Development.IDE.Session (findCradle, defaultLoadingOptions) +import HIE.Bios hiding (findCradle) import HIE.Bios.Environment import HIE.Bios.Types import Ide.Arguments @@ -135,7 +136,7 @@ getRuntimeGhcVersion' cradle = do -- of the project that may or may not be accurate. findLocalCradle :: FilePath -> IO (Cradle Void) findLocalCradle fp = do - cradleConf <- findCradle fp + cradleConf <- (findCradle defaultLoadingOptions) fp crdl <- case cradleConf of Just yaml -> do hPutStrLn stderr $ "Found \"" ++ yaml ++ "\" for \"" ++ fp ++ "\"" diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index b4611c77ce..fca3471ec5 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -62,7 +62,6 @@ library , ghcide >=0.6 , gitrev , haskell-lsp ^>=0.22 - , hie-bios >=0.7.1 && <0.8 , hls-plugin-api >=0.5 , hslogger , optparse-applicative @@ -170,6 +169,7 @@ executable haskell-language-server-wrapper build-depends: , ghc , ghc-paths + , ghcide , gitrev , haskell-language-server , hie-bios diff --git a/src/Ide/Main.hs b/src/Ide/Main.hs index 6feef3702e..4eda145c40 100644 --- a/src/Ide/Main.hs +++ b/src/Ide/Main.hs @@ -34,19 +34,18 @@ import Development.IDE.Core.Shake import Development.IDE.LSP.LanguageServer import Development.IDE.LSP.Protocol import Development.IDE.Plugin -import Development.IDE.Session +import Development.IDE.Session (loadSession, findCradle, defaultLoadingOptions) import Development.IDE.Types.Diagnostics import Development.IDE.Types.Location import Development.IDE.Types.Logger import Development.IDE.Types.Options -import HIE.Bios.Cradle import qualified Language.Haskell.LSP.Core as LSP import Ide.Arguments import Ide.Logger import Ide.Plugin import Ide.Version import Ide.Plugin.Config -import Ide.Types (IdePlugins, ipMap) +import Ide.Types (IdePlugins, ipMap) import Language.Haskell.LSP.Messages import Language.Haskell.LSP.Types import qualified System.Directory.Extra as IO @@ -158,7 +157,7 @@ runLspMode lspArgs@LspArguments{..} idePlugins = do putStrLn $ "Found " ++ show (length files) ++ " files" putStrLn "\nStep 2/4: Looking for hie.yaml files that control setup" - cradles <- mapM findCradle files + cradles <- mapM (findCradle defaultLoadingOptions) files let ucradles = nubOrd cradles let n = length ucradles putStrLn $ "Found " ++ show n ++ " cradle" ++ ['s' | n /= 1] From 477863127d4c30234bbd51194efb1b0259cdf37e Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 21:09:07 +0100 Subject: [PATCH 07/15] Add shake-bench component to nix build --- nix/default.nix | 1 + shell.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/nix/default.nix b/nix/default.nix index 625382b3cd..02ed1cbea1 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -17,6 +17,7 @@ let haskellPackages.extend (pkgs.haskell.lib.packageSourceOverrides { haskell-language-server = gitignoreSource ../.; ghcide = gitignoreSource ../ghcide; + shake-bench = gitignoreSource ../ghcide/shake-bench; hie-compat = gitignoreSource ../ghcide/hie-compat; hls-plugin-api = gitignoreSource ../hls-plugin-api; hls-tactics-plugin = gitignoreSource ../plugins/tactics; diff --git a/shell.nix b/shell.nix index c91cacdbed..0b0df7427e 100644 --- a/shell.nix +++ b/shell.nix @@ -26,6 +26,7 @@ let defaultCompiler = "ghc" + lib.replaceStrings ["."] [""] haskellPackages.ghc. packages = p: [ p.haskell-language-server p.ghcide + p.shake-bench p.hie-compat p.hls-plugin-api p.hls-tactics-plugin From 9ef6cbd74b9a983796dc5c063ed6503ecde6aca5 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 9 Dec 2020 21:10:33 +0100 Subject: [PATCH 08/15] Use brittany version compat with ghc-8.10 --- cabal.project | 4 ++-- stack-8.10.1.yaml | 8 ++------ stack-8.10.2.yaml | 8 ++------ stack-8.6.4.yaml | 4 ++-- stack-8.6.5.yaml | 4 ++-- stack-8.8.2.yaml | 5 ++--- stack-8.8.3.yaml | 4 ++-- stack-8.8.4.yaml | 4 ++-- stack.yaml | 4 ++-- 9 files changed, 18 insertions(+), 27 deletions(-) diff --git a/cabal.project b/cabal.project index d17c232452..e0ffe04263 100644 --- a/cabal.project +++ b/cabal.project @@ -10,8 +10,8 @@ packages: source-repository-package type: git - location: https://github.com/bubba/brittany.git - tag: c59655f10d5ad295c2481537fc8abf0a297d9d1c + location: https://github.com/lspitzner/brittany.git + tag: 0a710ab27147d4f7981fe4ca343b43136ee36919 tests: true diff --git a/stack-8.10.1.yaml b/stack-8.10.1.yaml index adf8a6fdb0..c3aa894e3b 100644 --- a/stack-8.10.1.yaml +++ b/stack-8.10.1.yaml @@ -14,8 +14,8 @@ ghc-options: "$everything": -haddock extra-deps: -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - Cabal-3.0.2.0 - clock-0.7.2 - data-tree-print-0.1.0.2@rev:2 @@ -46,10 +46,6 @@ flags: retrie: BuildExecutable: false -# for brittany's bounds on strict (>=0.3.2 && <0.4); using strict-0.4.0.1. -# https://github.com/lspitzner/brittany/issues/328 -allow-newer: true - nix: packages: [ icu libcxx zlib ] diff --git a/stack-8.10.2.yaml b/stack-8.10.2.yaml index 25b04bee14..f55be2c34e 100644 --- a/stack-8.10.2.yaml +++ b/stack-8.10.2.yaml @@ -14,8 +14,8 @@ ghc-options: "$everything": -haddock extra-deps: -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - Cabal-3.0.2.0 - clock-0.7.2 - data-tree-print-0.1.0.2@rev:2 @@ -38,10 +38,6 @@ flags: retrie: BuildExecutable: false -# for brittany's bounds on strict (>=0.3.2 && <0.4); using strict-0.4.0.1. -# https://github.com/lspitzner/brittany/issues/328 -allow-newer: true - nix: packages: [ icu libcxx zlib ] diff --git a/stack-8.6.4.yaml b/stack-8.6.4.yaml index 1232009d82..a085023a34 100644 --- a/stack-8.6.4.yaml +++ b/stack-8.6.4.yaml @@ -19,8 +19,8 @@ extra-deps: - apply-refact-0.8.2.1 - ansi-terminal-0.10.3 - base-compat-0.10.5 -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - butcher-1.3.3.1 - Cabal-3.0.2.0 - cabal-plan-0.6.2.0 diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml index b48f225490..304a35f334 100644 --- a/stack-8.6.5.yaml +++ b/stack-8.6.5.yaml @@ -18,8 +18,8 @@ extra-deps: - apply-refact-0.8.2.1 - ansi-terminal-0.10.3 - base-compat-0.10.5 -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - butcher-1.3.3.1 - Cabal-3.0.2.0 - cabal-plan-0.6.2.0 diff --git a/stack-8.8.2.yaml b/stack-8.8.2.yaml index 78ba0c9c51..8bc5919b8a 100644 --- a/stack-8.8.2.yaml +++ b/stack-8.8.2.yaml @@ -15,9 +15,8 @@ ghc-options: extra-deps: - aeson-1.5.2.0 -- apply-refact-0.8.2.1 -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - butcher-1.3.3.2 - bytestring-trie-0.2.5.0 - clock-0.7.2 diff --git a/stack-8.8.3.yaml b/stack-8.8.3.yaml index 66a3c589eb..a53ea1cb70 100644 --- a/stack-8.8.3.yaml +++ b/stack-8.8.3.yaml @@ -16,8 +16,8 @@ ghc-options: extra-deps: - aeson-1.5.2.0 - apply-refact-0.8.2.1 -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - bytestring-trie-0.2.5.0 - cabal-plan-0.6.2.0 - clock-0.7.2 diff --git a/stack-8.8.4.yaml b/stack-8.8.4.yaml index f04a81e68c..fc50d9b7d7 100644 --- a/stack-8.8.4.yaml +++ b/stack-8.8.4.yaml @@ -16,8 +16,8 @@ ghc-options: extra-deps: - aeson-1.5.2.0 - apply-refact-0.8.2.1 -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - bytestring-trie-0.2.5.0 - cabal-plan-0.6.2.0 - clock-0.7.2 diff --git a/stack.yaml b/stack.yaml index 5fcab7abd3..238c04e01d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -18,8 +18,8 @@ extra-deps: - apply-refact-0.8.2.1 - ansi-terminal-0.10.3 - base-compat-0.10.5 -- github: bubba/brittany - commit: c59655f10d5ad295c2481537fc8abf0a297d9d1c +- github: lspitzner/brittany + commit: 0a710ab27147d4f7981fe4ca343b43136ee36919 - butcher-1.3.3.1 - Cabal-3.0.2.0 - cabal-plan-0.6.2.0 From cda2e88280bb182def6de0df0e8405677fca7c2a Mon Sep 17 00:00:00 2001 From: jneira Date: Fri, 11 Dec 2020 13:16:42 +0100 Subject: [PATCH 09/15] Use ghcide version fixed for ghc-8.x --- ghcide | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghcide b/ghcide index baafe2cb82..27b4250bb2 160000 --- a/ghcide +++ b/ghcide @@ -1 +1 @@ -Subproject commit baafe2cb82215f992ded3e3c1bd03507553aae86 +Subproject commit 27b4250bb245cbe44c2d63eeda5743d9807fe4a0 From 38849ffd35aef3804472f1512500cb28dd6d0b35 Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Sat, 12 Dec 2020 11:55:44 -0600 Subject: [PATCH 10/15] Ensure that loading testfiles produces at least one diagnostic. completion/Context.hs used to generate a diagnostic for the unused "x", but no longer does so without -Wunused-binds. completion/Completion.hs used to generate a diagnostic for the unused import of Data.Maybe, but no longer does so without -Wunused-imports. We could add these flags like: {-# OPTIONS_GHC -Wunused-binds #-} But that would force us to update all the hardcoded line numbers in the unit tests. Instead we just add a redundant id, carefully positioned to avoid disturbing any hardcoded positions. --- test/testdata/completion/Completion.hs | 2 +- test/testdata/completion/Context.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testdata/completion/Completion.hs b/test/testdata/completion/Completion.hs index d6480903b6..1e394a8f21 100644 --- a/test/testdata/completion/Completion.hs +++ b/test/testdata/completion/Completion.hs @@ -6,4 +6,4 @@ main :: IO () main = putStrLn "hello" foo :: Either a b -> Either a b -foo = id \ No newline at end of file +foo = id id diff --git a/test/testdata/completion/Context.hs b/test/testdata/completion/Context.hs index 45c5befb10..8ca546e055 100644 --- a/test/testdata/completion/Context.hs +++ b/test/testdata/completion/Context.hs @@ -1,4 +1,4 @@ module Context where import Control.Concurrent as Conc foo :: Int -> Int -foo x = abs 42 \ No newline at end of file +foo x = abs $ id 42 From 03891aaaf6744f5011cd91b8e910e0dffb369389 Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Sat, 12 Dec 2020 12:19:09 -0600 Subject: [PATCH 11/15] Update completion tests to reflect the renewed support for snippets in ghcide 6.0. --- test/functional/Completion.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/functional/Completion.hs b/test/functional/Completion.hs index d49626c000..c4f2fd0671 100644 --- a/test/functional/Completion.hs +++ b/test/functional/Completion.hs @@ -29,8 +29,8 @@ tests = testGroup "completions" [ item ^. label @?= "putStrLn" item ^. kind @?= Just CiFunction item ^. detail @?= Just ":: String -> IO ()" - item ^. insertTextFormat @?= Just PlainText - item ^. insertText @?= Nothing + item ^. insertTextFormat @?= Just Snippet + item ^. insertText @?= Just "putStrLn ${1:String}" , ignoreTestBecause "no support for itemCompletion/resolve requests" $ testCase "itemCompletion/resolve works" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do @@ -105,8 +105,8 @@ tests = testGroup "completions" [ liftIO $ do item ^. label @?= "LANGUAGE" item ^. kind @?= Just CiKeyword - item ^. insertTextFormat @?= Just PlainText - item ^. insertText @?= Nothing + item ^. insertTextFormat @?= Just Snippet + item ^. insertText @?= Just "LANGUAGE ${1:extension} #-}" , testCase "completes pragmas no close" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" @@ -120,8 +120,8 @@ tests = testGroup "completions" [ liftIO $ do item ^. label @?= "LANGUAGE" item ^. kind @?= Just CiKeyword - item ^. insertTextFormat @?= Just PlainText - item ^. insertText @?= Nothing + item ^. insertTextFormat @?= Just Snippet + item ^. insertText @?= Just "LANGUAGE ${1:extension}" , testCase "completes options pragma" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" @@ -135,8 +135,8 @@ tests = testGroup "completions" [ liftIO $ do item ^. label @?= "OPTIONS_GHC" item ^. kind @?= Just CiKeyword - item ^. insertTextFormat @?= Just PlainText - item ^. insertText @?= Nothing + item ^. insertTextFormat @?= Just Snippet + item ^. insertText @?= Just "OPTIONS_GHC -${1:option} #-}" , testCase "completes ghc options pragma values" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" From 154810fc888b2e3898a79b5b498b03edb8cdb454 Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Sat, 12 Dec 2020 12:21:04 -0600 Subject: [PATCH 12/15] Enable disabled tests for the code completion snippets. Snippets are back in ghcide 0.6.0. --- test/functional/Completion.hs | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/test/functional/Completion.hs b/test/functional/Completion.hs index c4f2fd0671..d1f87c4566 100644 --- a/test/functional/Completion.hs +++ b/test/functional/Completion.hs @@ -199,7 +199,6 @@ tests = testGroup "completions" [ snippetTests :: TestTree snippetTests = testGroup "snippets" [ - ignoreTestBecause "no support for snippets" $ testCase "work for argumentless constructors" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc @@ -211,10 +210,9 @@ snippetTests = testGroup "snippets" [ let item = head $ filter ((== "Nothing") . (^. label)) compls liftIO $ do item ^. insertTextFormat @?= Just Snippet - item ^. insertText @?= Just "Nothing" + item ^. insertText @?= Just "Nothing " - , ignoreTestBecause "no support for snippets" $ - testCase "work for polymorphic types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do + , testCase "work for polymorphic types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc @@ -229,8 +227,7 @@ snippetTests = testGroup "snippets" [ item ^. insertTextFormat @?= Just Snippet item ^. insertText @?= Just "foldl ${1:b -> a -> b} ${2:b} ${3:t a}" - , ignoreTestBecause "no support for snippets" $ - testCase "work for complex types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do + , testCase "work for complex types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc @@ -245,8 +242,7 @@ snippetTests = testGroup "snippets" [ item ^. insertTextFormat @?= Just Snippet item ^. insertText @?= Just "mapM ${1:a -> m b} ${2:t a}" - , ignoreTestBecause "no support for snippets" $ - testCase "work for infix functions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do + , testCase "work for infix functions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc @@ -259,10 +255,9 @@ snippetTests = testGroup "snippets" [ item ^. label @?= "filter" item ^. kind @?= Just CiFunction item ^. insertTextFormat @?= Just Snippet - item ^. insertText @?= Just "filter`" + item ^. insertText @?= Just "filter ${1:a -> Bool} ${2:[a]}" - , ignoreTestBecause "no support for snippets" $ - testCase "work for infix functions in backticks" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do + , testCase "work for infix functions in backticks" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc @@ -275,10 +270,9 @@ snippetTests = testGroup "snippets" [ item ^. label @?= "filter" item ^. kind @?= Just CiFunction item ^. insertTextFormat @?= Just Snippet - item ^. insertText @?= Just "filter" + item ^. insertText @?= Just "filter ${1:a -> Bool} ${2:[a]}" - , ignoreTestBecause "no support for snippets" $ - testCase "work for qualified infix functions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do + , testCase "work for qualified infix functions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc @@ -291,10 +285,9 @@ snippetTests = testGroup "snippets" [ item ^. label @?= "intersperse" item ^. kind @?= Just CiFunction item ^. insertTextFormat @?= Just Snippet - item ^. insertText @?= Just "intersperse`" + item ^. insertText @?= Just "intersperse ${1:a} ${2:[a]}" - , ignoreTestBecause "no support for snippets" $ - testCase "work for qualified infix functions in backticks" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do + , testCase "work for qualified infix functions in backticks" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc @@ -307,7 +300,7 @@ snippetTests = testGroup "snippets" [ item ^. label @?= "intersperse" item ^. kind @?= Just CiFunction item ^. insertTextFormat @?= Just Snippet - item ^. insertText @?= Just "intersperse" + item ^. insertText @?= Just "intersperse ${1:a} ${2:[a]}" , testCase "respects lsp configuration" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" From 33dee2ef8b21ca3b260c236e2369a239a7ba2057 Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Sat, 12 Dec 2020 14:47:13 -0600 Subject: [PATCH 13/15] Disable test for completionSnippetsOn option, ghcide does not support it. --- test/functional/Completion.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/functional/Completion.hs b/test/functional/Completion.hs index d1f87c4566..d902460f13 100644 --- a/test/functional/Completion.hs +++ b/test/functional/Completion.hs @@ -302,7 +302,8 @@ snippetTests = testGroup "snippets" [ item ^. insertTextFormat @?= Just Snippet item ^. insertText @?= Just "intersperse ${1:a} ${2:[a]}" - , testCase "respects lsp configuration" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do + , ignoreTestBecause "ghcide does not support the completionSnippetsOn option" $ + testCase "respects lsp configuration" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" _ <- waitForDiagnosticsFrom doc From cd496cb5f95460e9af037fbb8da423cdbc590a9d Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Sat, 12 Dec 2020 14:49:52 -0600 Subject: [PATCH 14/15] Fix test for code completion of qualified name. Stop messing around the editing the file and reloading it. We are trying to test code completion, not editing files, and the extra complexity is making it harder to maintain the test. --- test/functional/Completion.hs | 19 +------------------ test/testdata/completion/Context.hs | 2 +- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/test/functional/Completion.hs b/test/functional/Completion.hs index d902460f13..fef31e7183 100644 --- a/test/functional/Completion.hs +++ b/test/functional/Completion.hs @@ -366,28 +366,11 @@ contextTests = testGroup "contexts" [ , testCase "completes qualified type suggestions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do doc <- openDoc "Context.hs" "haskell" _ <- waitForDiagnosticsFrom doc - let te = TextEdit (Range (Position 2 17) (Position 2 17)) " -> Conc." - _ <- applyEdit doc te - -- The module doesn't parse right now. So we are using stale data. HLS - -- can give us completions for "Conc." but it can't tell that we are in - -- a context where we expect a type. compls <- getCompletions doc (Position 2 26) liftIO $ do - -- forkOn is an inappropriate completion in a type context. - compls `shouldContainCompl` "forkOn" + compls `shouldNotContainCompl` "forkOn" compls `shouldContainCompl` "MVar" compls `shouldContainCompl` "Chan" - let te' = TextEdit (Range (Position 2 26) (Position 2 26)) "MVar" - _ <- applyEdit doc te' - -- The module can now be parsed. Wait until it has been. - _ <- waitForDiagnosticsFrom doc - -- HLS can see that we are expecting a type. - compls' <- getCompletions doc (Position 2 26) - liftIO $ do - -- forkOn is gone. - compls' `shouldNotContainCompl` "forkOn" - compls' `shouldContainCompl` "MVar" - compls' `shouldContainCompl` "Chan" ] shouldContainCompl :: [CompletionItem] -> T.Text -> Assertion diff --git a/test/testdata/completion/Context.hs b/test/testdata/completion/Context.hs index 8ca546e055..2f6effccb6 100644 --- a/test/testdata/completion/Context.hs +++ b/test/testdata/completion/Context.hs @@ -1,4 +1,4 @@ module Context where import Control.Concurrent as Conc -foo :: Int -> Int +foo :: Int -> Int -> Conc.MVar foo x = abs $ id 42 From 1004bd2c7d21ce9e0fb336f18bfa3d448df4d93a Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Sun, 13 Dec 2020 12:47:44 -0600 Subject: [PATCH 15/15] Ensure that the testfiles produce at least one diagnostic. --- test/functional/FunctionalCodeAction.hs | 5 +++-- test/testdata/Highlight.hs | 2 +- test/testdata/redundantImportTest/src/CodeActionRedundant.hs | 3 ++- test/testdata/redundantImportTest/src/MultipleImports.hs | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/functional/FunctionalCodeAction.hs b/test/functional/FunctionalCodeAction.hs index 81bfa2a243..9e7b1149f4 100644 --- a/test/functional/FunctionalCodeAction.hs +++ b/test/functional/FunctionalCodeAction.hs @@ -276,7 +276,7 @@ redundantImportTests = testGroup "redundant import code actions" [ -- provides workspace edit property which skips round trip to -- the server contents <- documentContents doc - liftIO $ contents @?= "module CodeActionRedundant where\nmain :: IO ()\nmain = putStrLn \"hello\"" + liftIO $ contents @?= "{-# OPTIONS_GHC -Wunused-imports #-}\nmodule CodeActionRedundant where\nmain :: IO ()\nmain = putStrLn \"hello\"\n" , testCase "doesn't touch other imports" $ runSession hlsCommand noLiteralCaps "test/testdata/redundantImportTest/" $ do doc <- openDoc "src/MultipleImports.hs" "haskell" @@ -285,7 +285,8 @@ redundantImportTests = testGroup "redundant import code actions" [ executeCommand cmd contents <- documentContents doc liftIO $ (T.lines contents) @?= - [ "module MultipleImports where" + [ "{-# OPTIONS_GHC -Wunused-imports #-}" + , "module MultipleImports where" , "import Data.Maybe" , "foo :: Int" , "foo = fromJust (Just 3)" diff --git a/test/testdata/Highlight.hs b/test/testdata/Highlight.hs index 8d92d18779..b58460b896 100644 --- a/test/testdata/Highlight.hs +++ b/test/testdata/Highlight.hs @@ -2,4 +2,4 @@ module Highlight where foo :: Int foo = 3 bar = foo - where baz = let x = foo in x + where baz = let x = foo in id x diff --git a/test/testdata/redundantImportTest/src/CodeActionRedundant.hs b/test/testdata/redundantImportTest/src/CodeActionRedundant.hs index 870fc5b16a..f56d232f27 100644 --- a/test/testdata/redundantImportTest/src/CodeActionRedundant.hs +++ b/test/testdata/redundantImportTest/src/CodeActionRedundant.hs @@ -1,4 +1,5 @@ +{-# OPTIONS_GHC -Wunused-imports #-} module CodeActionRedundant where import Data.List main :: IO () -main = putStrLn "hello" \ No newline at end of file +main = putStrLn "hello" diff --git a/test/testdata/redundantImportTest/src/MultipleImports.hs b/test/testdata/redundantImportTest/src/MultipleImports.hs index 4bc5508b61..7a8278b1d3 100644 --- a/test/testdata/redundantImportTest/src/MultipleImports.hs +++ b/test/testdata/redundantImportTest/src/MultipleImports.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -Wunused-imports #-} module MultipleImports where import Data.Foldable import Data.Maybe