diff --git a/.gitmodules b/.gitmodules index edbeb396b..a16cde630 100644 --- a/.gitmodules +++ b/.gitmodules @@ -18,4 +18,7 @@ [submodule "submodules/ghc-mod"] path = submodules/ghc-mod - url = https://github.com/fendor/ghc-mod.git \ No newline at end of file + url = https://github.com/fendor/ghc-mod.git +[submodule "submodules/apply-refact"] + path = submodules/apply-refact + url = https://github.com/mpickering/apply-refact.git diff --git a/app/MainHie.hs b/app/MainHie.hs index 27e2770f3..1cb91119a 100644 --- a/app/MainHie.hs +++ b/app/MainHie.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} module Main where diff --git a/hie-plugin-api/Haskell/Ide/Engine/Ghc.hs b/hie-plugin-api/Haskell/Ide/Engine/Ghc.hs index 81d9d6a63..d5efb5b9f 100644 --- a/hie-plugin-api/Haskell/Ide/Engine/Ghc.hs +++ b/hie-plugin-api/Haskell/Ide/Engine/Ghc.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} diff --git a/hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs b/hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs index 120c6776e..0506cf392 100644 --- a/hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs +++ b/hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveAnyClass #-} diff --git a/install/shake.yaml b/install/shake.yaml index 8c30114fa..22867942f 100644 --- a/install/shake.yaml +++ b/install/shake.yaml @@ -1,5 +1,5 @@ # Used to provide a different environment for the shake build script -resolver: lts-14.11 # GHC 8.6.5 +resolver: lts-14.17 # GHC 8.6.5 packages: - . diff --git a/src/Haskell/Ide/Engine/LSP/Completions.hs b/src/Haskell/Ide/Engine/LSP/Completions.hs index ea322c768..db1f1c329 100644 --- a/src/Haskell/Ide/Engine/LSP/Completions.hs +++ b/src/Haskell/Ide/Engine/LSP/Completions.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} diff --git a/src/Haskell/Ide/Engine/Plugin/ApplyRefact.hs b/src/Haskell/Ide/Engine/Plugin/ApplyRefact.hs index 33fca9188..1fd12a590 100644 --- a/src/Haskell/Ide/Engine/Plugin/ApplyRefact.hs +++ b/src/Haskell/Ide/Engine/Plugin/ApplyRefact.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} diff --git a/src/Haskell/Ide/Engine/Plugin/Brittany.hs b/src/Haskell/Ide/Engine/Plugin/Brittany.hs index 8acd17c08..6e8464b02 100644 --- a/src/Haskell/Ide/Engine/Plugin/Brittany.hs +++ b/src/Haskell/Ide/Engine/Plugin/Brittany.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE OverloadedStrings #-} module Haskell.Ide.Engine.Plugin.Brittany where diff --git a/src/Haskell/Ide/Engine/Plugin/Generic.hs b/src/Haskell/Ide/Engine/Plugin/Generic.hs index e89f06e47..55e39d016 100644 --- a/src/Haskell/Ide/Engine/Plugin/Generic.hs +++ b/src/Haskell/Ide/Engine/Plugin/Generic.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} diff --git a/src/Haskell/Ide/Engine/Plugin/Haddock.hs b/src/Haskell/Ide/Engine/Plugin/Haddock.hs index f3aa088c8..b89352634 100644 --- a/src/Haskell/Ide/Engine/Plugin/Haddock.hs +++ b/src/Haskell/Ide/Engine/Plugin/Haddock.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} @@ -106,7 +107,11 @@ getDocsForName df name = do case mf of Nothing -> return Nothing Just f -> do +#if __GLASGOW_HASKELL__ >= 808 + ehi <- readInterfaceFile nameCacheFromIdeM f True +#else ehi <- readInterfaceFile nameCacheFromIdeM f +#endif case ehi of Left message -> do debugm $ "Haddock docs couldn't be loaded as readInterfaceFile failed with: " ++ message @@ -151,8 +156,15 @@ prettyprintType n t = T.unlines , "```\n" ] +unwrap :: Foldable w => w a -> a +unwrap = foldl1 (const id) + renderDocs :: MDoc Name -> T.Text +#if __GLASGOW_HASKELL__ >= 808 +renderDocs = markup renderMarkDown . _doc . fmap unwrap +#else renderDocs = markup renderMarkDown . _doc +#endif renderMarkDown :: DocMarkup Name T.Text renderMarkDown = @@ -161,7 +173,11 @@ renderMarkDown = , markupParagraph = (<> "\n\n") , markupAppend = mappend , markupIdentifier = surround "`" . T.pack . getOccString +#if __GLASGOW_HASKELL__ >= 808 + , markupIdentifierUnchecked = T.pack . occNameString . snd . unwrap +#else , markupIdentifierUnchecked = T.pack . occNameString . snd +#endif , markupModule = surround "**" . T.pack , markupWarning = surround "*" , markupEmphasis = surround "*" @@ -173,9 +189,16 @@ renderMarkDown = , markupDefList = T.unlines . map (\(a, b) -> a <> " :: " <> b) , markupCodeBlock = \x -> "\n```haskell\n" <> removeInner x <> "\n```\n" , markupHyperlink = \h -> - T.pack $ maybe +#if __GLASGOW_HASKELL__ >= 808 + let url = T.pack $ hyperlinkUrl h + in maybe + url + (\l -> "["<>l<>"]("<>url<>")") +#else + T.pack $ maybe (hyperlinkUrl h) (\l -> "["<>l<>"]("<>hyperlinkUrl h<>")") +#endif (hyperlinkLabel h) , markupAName = T.pack , markupPic = const "" diff --git a/src/Haskell/Ide/Engine/Plugin/HsImport.hs b/src/Haskell/Ide/Engine/Plugin/HsImport.hs index 55d9a2b85..b20e15835 100644 --- a/src/Haskell/Ide/Engine/Plugin/HsImport.hs +++ b/src/Haskell/Ide/Engine/Plugin/HsImport.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveAnyClass #-} diff --git a/src/Haskell/Ide/Engine/Plugin/Package.hs b/src/Haskell/Ide/Engine/Plugin/Package.hs index b8e4f402e..04b48479c 100644 --- a/src/Haskell/Ide/Engine/Plugin/Package.hs +++ b/src/Haskell/Ide/Engine/Plugin/Package.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} @@ -19,6 +20,7 @@ import qualified Data.ByteString as B import Data.Foldable import Data.List import qualified Data.HashMap.Strict as HM +import qualified Data.Set as S import qualified Data.Text as T import qualified Data.Text.Encoding as T import Data.Maybe @@ -301,7 +303,11 @@ editCabalPackage file modulePath pkgName fileMap = do -- Add it to the bottom of the dependencies list -- TODO: we could sort the depencies and then insert it, -- or insert it in order iff the list is already sorted. +#if __GLASGOW_HASKELL__ >= 808 + newDeps = oldDeps ++ [Dependency (mkPackageName (T.unpack dep)) anyVersion S.empty] +#else newDeps = oldDeps ++ [Dependency (mkPackageName (T.unpack dep)) anyVersion] +#endif -- | Provide a code action to add a package to the local package.yaml or cabal file. -- Reads from diagnostics the unknown import module path and searches for it on Hoogle. diff --git a/src/Haskell/Ide/Engine/Plugin/Pragmas.hs b/src/Haskell/Ide/Engine/Plugin/Pragmas.hs index 57b6cccb7..61d5a7918 100644 --- a/src/Haskell/Ide/Engine/Plugin/Pragmas.hs +++ b/src/Haskell/Ide/Engine/Plugin/Pragmas.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} diff --git a/src/Haskell/Ide/Engine/Scheduler.hs b/src/Haskell/Ide/Engine/Scheduler.hs index a94787487..42f1e4520 100644 --- a/src/Haskell/Ide/Engine/Scheduler.hs +++ b/src/Haskell/Ide/Engine/Scheduler.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ExistentialQuantification #-} diff --git a/src/Haskell/Ide/Engine/Support/HieExtras.hs b/src/Haskell/Ide/Engine/Support/HieExtras.hs index 446441cfe..ac018a393 100644 --- a/src/Haskell/Ide/Engine/Support/HieExtras.hs +++ b/src/Haskell/Ide/Engine/Support/HieExtras.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -336,7 +338,11 @@ gotoModule rfm mn = do flushFinderCaches env findImportedModule env mn Nothing case fr of +#if __GLASGOW_HASKELL__ < 808 Found (ModLocation (Just src) _ _) _ -> do +#else + Found (ModLocation (Just src) _ _ _) _ -> do +#endif fp <- reverseMapFile rfm src let r = Range (Position 0 0) (Position 0 0) diff --git a/src/Haskell/Ide/Engine/Transport/LspStdio.hs b/src/Haskell/Ide/Engine/Transport/LspStdio.hs index 27906e96d..a384c61c2 100644 --- a/src/Haskell/Ide/Engine/Transport/LspStdio.hs +++ b/src/Haskell/Ide/Engine/Transport/LspStdio.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml index 9e572be89..f775609f7 100644 --- a/stack-8.6.5.yaml +++ b/stack-8.6.5.yaml @@ -1,4 +1,4 @@ -resolver: lts-14.16 +resolver: lts-14.17 packages: - . - hie-plugin-api diff --git a/stack.yaml b/stack.yaml index 8dc95bf01..35e202156 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: nightly-2019-09-21 # Last GHC 8.6.5 +resolver: nightly-2019-12-18 packages: - . - hie-plugin-api @@ -7,31 +7,18 @@ extra-deps: # - ./submodules/HaRe - ./submodules/cabal-helper - ./submodules/ghc-mod/ghc-project-types - -- deque-0.4.3 -- ansi-terminal-0.8.2 +- ./submodules/apply-refact +- hie-bios-0.3.2 - bytestring-trie-0.2.5.0 -- ansi-wl-pprint-0.6.8.2 -- brittany-0.12.1.0 -- cabal-plan-0.5.0.0 - constrained-dynamic-0.1.0.0 +- fclabels-2.0.3.3 - floskell-0.10.2 -- ghc-lib-parser-8.8.1 -- haddock-api-2.22.0 -- haskell-lsp-0.19.0.0 -- haskell-lsp-types-0.19.0.0 -- hie-bios-0.3.2 -- hlint-2.2.4 +- fold-debounce-0.2.0.9 +- haddock-api-2.23.0 +- haddock-library-1.8.0 +- hoogle-5.0.17.13 - hsimport-0.11.0 -- lsp-test-0.9.0.0 -- monad-dijkstra-0.1.1.2@rev:1 -- syz-0.2.0.0 -- temporary-1.2.1.1 -- clock-0.7.2 -- ghc-exactprint-0.6.2 # for HaRe -- extra-1.6.18 -- unix-compat-0.5.2 -- yaml-0.11.1.2 +- monad-dijkstra-0.1.1.2 flags: haskell-ide-engine: diff --git a/submodules/apply-refact b/submodules/apply-refact new file mode 160000 index 000000000..1acf7eb86 --- /dev/null +++ b/submodules/apply-refact @@ -0,0 +1 @@ +Subproject commit 1acf7eb860be5a446828a3a2fe3644aeb5a1b55f