diff --git a/exe/Main.hs b/exe/Main.hs
--- a/exe/Main.hs
+++ b/exe/Main.hs
@@ -1,6 +1,5 @@
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
-{-# OPTIONS_GHC -Wno-dodgy-imports #-} -- GHC no longer exports def in GHC 8.6 and above
 {-# LANGUAGE TemplateHaskell #-}
 
 module Main(main) where
diff --git a/ghcide.cabal b/ghcide.cabal
--- a/ghcide.cabal
+++ b/ghcide.cabal
@@ -1,8 +1,8 @@
-cabal-version:      3.0
+cabal-version:      3.4
 build-type:         Simple
 category:           Development
 name:               ghcide
-version:            2.6.0.0
+version:            2.7.0.0
 license:            Apache-2.0
 license-file:       LICENSE
 author:             Digital Asset and Ghcide contributors
@@ -14,7 +14,7 @@
   https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme
 
 bug-reports:        https://github.com/haskell/haskell-language-server/issues
-tested-with:        GHC ==9.0.2 || ==9.2.5
+tested-with:        GHC ==9.8.2 || ==9.6.4 || ==9.4.8 || ==9.2.8
 extra-source-files:
   CHANGELOG.md
   README.md
@@ -40,13 +40,22 @@
   default:     False
   manual:      True
 
+common warnings
+  ghc-options:
+    -Wall
+    -Wincomplete-uni-patterns
+    -Wunused-packages
+    -Wno-name-shadowing
+    -Wno-unticked-promoted-constructors
+    -fno-ignore-asserts
+
 library
-  default-language:   Haskell2010
+  default-language:   GHC2021
   build-depends:
     , aeson
     , array
     , async
-    , base                         >=4        && <5
+    , base                         >=4.16     && <5
     , base16-bytestring            >=0.1.1    && <1.1
     , binary
     , bytestring
@@ -67,7 +76,7 @@
     , filepath
     , fingertree
     , focus                        >=1.0.3.2
-    , ghc                          >=9.0
+    , ghc                          >=9.2
     , ghc-boot
     , ghc-boot-th
     , ghc-check                    >=0.5.0.8
@@ -78,13 +87,13 @@
     , hashable
     , hie-bios                     ==0.13.1
     , hie-compat                   ^>=0.3.0.0
-    , hiedb                        ^>= 0.5.0.1
-    , hls-graph                    == 2.6.0.0
-    , hls-plugin-api               == 2.6.0.0
+    , hiedb                        ^>= 0.6.0.0
+    , hls-graph                    == 2.7.0.0
+    , hls-plugin-api               == 2.7.0.0
     , implicit-hie                 >= 0.1.4.0 && < 0.1.5
     , lens
     , list-t
-    , lsp                          ^>=2.3.0.0
+    , lsp                          ^>=2.4.0.0
     , lsp-types                    ^>=2.1.0.0
     , mtl
     , opentelemetry                >=0.6.1
@@ -117,24 +126,11 @@
     build-depends: unix
 
   default-extensions:
-    BangPatterns
     DataKinds
-    DeriveFoldable
-    DeriveFunctor
-    DeriveGeneric
-    DeriveTraversable
-    FlexibleContexts
-    GeneralizedNewtypeDeriving
-    KindSignatures
+    ExplicitNamespaces
     LambdaCase
-    NamedFieldPuns
     OverloadedStrings
     RecordWildCards
-    ScopedTypeVariables
-    StandaloneDeriving
-    TupleSections
-    TypeApplications
-    TypeOperators
     ViewPatterns
 
   hs-source-dirs:     src session-loader
@@ -187,6 +183,7 @@
     Development.IDE.Plugin
     Development.IDE.Plugin.Completions
     Development.IDE.Plugin.Completions.Types
+    Development.IDE.Plugin.Completions.Logic
     Development.IDE.Plugin.HLS
     Development.IDE.Plugin.HLS.GhcIde
     Development.IDE.Plugin.Test
@@ -214,30 +211,12 @@
     Development.IDE.Core.FileExists
     Development.IDE.GHC.CPP
     Development.IDE.GHC.Warnings
-    Development.IDE.Plugin.Completions.Logic
     Development.IDE.Session.VersionCheck
     Development.IDE.Types.Action
 
-  ghc-options:
-    -Wall -Wincomplete-uni-patterns -Wno-unticked-promoted-constructors
-    -Wunused-packages -fno-ignore-asserts
-
   if flag(pedantic)
-    -- We eventually want to build with Werror fully, but we haven't
-    -- finished purging the warnings, so some are set to not be errors
-    -- for now
     ghc-options:
-      -Werror -Wwarn=unused-packages -Wwarn=unrecognised-pragmas
-      -Wwarn=dodgy-imports -Wwarn=missing-signatures
-      -Wwarn=duplicate-exports -Wwarn=dodgy-exports
-      -Wwarn=incomplete-patterns -Wwarn=overlapping-patterns
-      -Wwarn=incomplete-record-updates
-
-  -- ambiguous-fields is only understood by GHC >= 9.2, so we only disable it
-  -- then. The above comment goes for here too -- this should be understood to
-  -- be temporary until we can remove these warnings.
-  if (impl(ghc >=9.2) && flag(pedantic))
-    ghc-options: -Wwarn=ambiguous-fields
+      -Werror
 
   if flag(ekg)
     build-depends:
@@ -251,9 +230,9 @@
   default:     True
 
 executable ghcide-test-preprocessor
-  default-language: Haskell2010
+  import: warnings
+  default-language:   GHC2021
   hs-source-dirs:   test/preprocessor
-  ghc-options:      -Wall -Wno-name-shadowing
   main-is:          Main.hs
   build-depends:    base >=4 && <5
 
@@ -265,19 +244,19 @@
   default:     True
 
 executable ghcide
-  default-language:   Haskell2010
+  import: warnings
+  default-language:   GHC2021
   hs-source-dirs:     exe
-  ghc-options:
-    -threaded -Wall -Wincomplete-uni-patterns -Wno-name-shadowing
-    -rtsopts "-with-rtsopts=-I0 -A128M -T"
+  ghc-options:        -threaded -rtsopts "-with-rtsopts=-I0 -A128M -T"
 
+
   -- allow user RTS overrides
   -- disable idle GC
   -- increase nursery size
   -- Enable collection of heap statistics
   main-is:            Main.hs
   build-depends:
-    , base                  >=4 && <5
+    , base                  >=4.16 && <5
     , data-default
     , extra
     , ghcide
@@ -293,37 +272,52 @@
 
   autogen-modules:    Paths_ghcide
   default-extensions:
-    BangPatterns
-    DeriveFunctor
-    DeriveGeneric
-    FlexibleContexts
-    GeneralizedNewtypeDeriving
     LambdaCase
-    NamedFieldPuns
     OverloadedStrings
     RecordWildCards
-    ScopedTypeVariables
-    StandaloneDeriving
-    TupleSections
-    TypeApplications
     ViewPatterns
 
   if !flag(executable)
     buildable: False
 
-  if flag(ekg)
-    build-depends:
-      , ekg-core
-      , ekg-wai
+library ghcide-test-utils
+  import: warnings
+  visibility: public
+  default-language:   GHC2021
 
-    cpp-options:   -DMONITORING_EKG
+  hs-source-dirs: test/src test/cabal 
+  exposed-modules:
+    Development.IDE.Test
+    Development.IDE.Test.Runfiles
+    Development.IDE.Test.Diagnostic
 
-  if impl(ghc >=9)
-    ghc-options: -Wunused-packages
+  build-depends:
+      aeson,
+      base > 4.9 && < 5,
+      containers,
+      data-default,
+      directory,
+      extra,
+      filepath,
+      ghcide,
+      lsp-types,
+      hls-plugin-api,
+      lens,
+      lsp-test ^>= 0.17,
+      tasty-hunit >= 0.10,
+      text,
+      row-types,
 
+  default-extensions:
+      LambdaCase
+      OverloadedStrings
+      RecordWildCards
+      ViewPatterns
+  
 test-suite ghcide-tests
+  import: warnings
   type:               exitcode-stdio-1.0
-  default-language:   Haskell2010
+  default-language:   GHC2021
   build-tool-depends:
     , ghcide:ghcide
     , ghcide:ghcide-test-preprocessor
@@ -340,13 +334,13 @@
     , extra
     , filepath
     , fuzzy
-    , ghc
     , ghcide
+    , ghcide:ghcide-test-utils
     , hls-plugin-api
     , lens
     , list-t
     , lsp
-    , lsp-test                ^>=0.16.0.0
+    , lsp-test                ^>=0.17.0.0
     , lsp-types
     , monoid-subclasses
     , mtl
@@ -368,25 +362,11 @@
     , text-rope
     , unordered-containers
 
-  --------------------------------------------------------------
-  -- The MIN_VERSION_ghc macro relies on MIN_VERSION pragmas
-  -- which require depending on ghc. So the tests need to depend
-  -- on ghc if they need to use MIN_VERSION_ghc. Maybe a
-  -- better solution can be found, but this is a quick solution
-  -- which works for now.
-  --------------------------------------------------------------
-  if impl(ghc <9.2)
-    build-depends:
-      , record-dot-preprocessor
-      , record-hasfield
-
   if impl(ghc <9.3)
     build-depends: ghc-typelits-knownnat
 
-  hs-source-dirs:     test/cabal test/exe test/src
-  ghc-options:
-    -threaded -Wall -Wno-name-shadowing -O0
-    -Wno-unticked-promoted-constructors -Wunused-packages
+  hs-source-dirs:     test/exe 
+  ghc-options:        -threaded -O0
 
   main-is:            Main.hs
   other-modules:
@@ -398,9 +378,6 @@
     CPPTests
     CradleTests
     DependentFileTest
-    Development.IDE.Test
-    Development.IDE.Test.Diagnostic
-    Development.IDE.Test.Runfiles
     DiagnosticTests
     ExceptionTests
     FindDefinitionAndHoverTests
@@ -431,17 +408,7 @@
 
   -- Tests that have been pulled out of the main file
   default-extensions:
-    BangPatterns
-    DeriveFunctor
-    DeriveGeneric
-    FlexibleContexts
-    GeneralizedNewtypeDeriving
     LambdaCase
-    NamedFieldPuns
     OverloadedStrings
     RecordWildCards
-    ScopedTypeVariables
-    StandaloneDeriving
-    TupleSections
-    TypeApplications
     ViewPatterns
diff --git a/session-loader/Development/IDE/Session.hs b/session-loader/Development/IDE/Session.hs
--- a/session-loader/Development/IDE/Session.hs
+++ b/session-loader/Development/IDE/Session.hs
@@ -1,7 +1,5 @@
-{-# LANGUAGE CPP                       #-}
-{-# LANGUAGE ExistentialQuantification #-}
-{-# LANGUAGE RankNTypes                #-}
-{-# LANGUAGE TypeFamilies              #-}
+{-# LANGUAGE CPP          #-}
+{-# LANGUAGE TypeFamilies #-}
 
 {-|
 The logic for setting up a ghcide session by tapping into hie-bios.
@@ -534,7 +532,7 @@
                   -- compilation but these are the true source of
                   -- information.
                   new_deps = fmap (\(df, targets) -> RawComponentInfo (homeUnitId_ df) df targets cfp opts dep_info) newTargetDfs
-                  all_deps = new_deps `NE.appendList` maybe [] id oldDeps
+                  all_deps = new_deps `NE.appendList` fromMaybe [] oldDeps
                   -- Get all the unit-ids for things in this component
                   _inplace = map rawComponentUnitId $ NE.toList all_deps
 
@@ -594,7 +592,7 @@
           void $ modifyVar' fileToFlags $
               Map.insert hieYaml this_flags_map
           void $ modifyVar' filesMap $
-              flip HM.union (HM.fromList (zip (map fst $ concatMap toFlagsMap all_targets) (repeat hieYaml)))
+              flip HM.union (HM.fromList (map ((,hieYaml) . fst) $ concatMap toFlagsMap all_targets))
 
           void $ extendKnownTargets all_targets
 
@@ -637,7 +635,7 @@
            -- Display a user friendly progress message here: They probably don't know what a cradle is
            let progMsg = "Setting up " <> T.pack (takeBaseName (cradleRootDir cradle))
                          <> " (for " <> T.pack lfp <> ")"
-           eopts <- mRunLspTCallback lspEnv (withIndefiniteProgress progMsg NotCancellable) $
+           eopts <- mRunLspTCallback lspEnv (\act -> withIndefiniteProgress progMsg Nothing NotCancellable (const act)) $
               withTrace "Load cradle" $ \addTag -> do
                   addTag "file" lfp
                   old_files <- readIORef cradle_files
@@ -685,7 +683,7 @@
                   -- again.
                   modifyVar_ fileToFlags (const (return Map.empty))
                   -- Keep the same name cache
-                  modifyVar_ hscEnvs (return . Map.adjust (\_ -> []) hieYaml )
+                  modifyVar_ hscEnvs (return . Map.adjust (const []) hieYaml )
                   consultCradle hieYaml cfp
                 else return (opts, Map.keys old_di)
             Nothing -> consultCradle hieYaml cfp
diff --git a/session-loader/Development/IDE/Session/Diagnostics.hs b/session-loader/Development/IDE/Session/Diagnostics.hs
--- a/session-loader/Development/IDE/Session/Diagnostics.hs
+++ b/session-loader/Development/IDE/Session/Diagnostics.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric  #-}
 
 module Development.IDE.Session.Diagnostics where
 import           Control.Applicative
diff --git a/session-loader/Development/IDE/Session/Implicit.hs b/session-loader/Development/IDE/Session/Implicit.hs
--- a/session-loader/Development/IDE/Session/Implicit.hs
+++ b/session-loader/Development/IDE/Session/Implicit.hs
@@ -3,26 +3,27 @@
   ) where
 
 
-import           Control.Applicative               ((<|>))
+import           Control.Applicative       ((<|>))
+import           Control.Exception         (handleJust)
 import           Control.Monad
-import           Control.Monad.Trans.Maybe
 import           Control.Monad.IO.Class
-import           Control.Exception (handleJust)
+import           Control.Monad.Trans.Maybe
 import           Data.Bifunctor
+import           Data.Functor              ((<&>))
 import           Data.Maybe
 import           Data.Void
+import           System.Directory          hiding (findFile)
 import           System.FilePath
-import           System.Directory                  hiding (findFile)
 import           System.IO.Error
 
-import           Colog.Core                        (LogAction (..), WithSeverity (..))
-import           HIE.Bios.Cradle                   (getCradle, defaultCradle)
+import           Colog.Core                (LogAction (..), WithSeverity (..))
 import           HIE.Bios.Config
-import           HIE.Bios.Types                    hiding (ActionName(..))
+import           HIE.Bios.Cradle           (defaultCradle, getCradle)
+import           HIE.Bios.Types            hiding (ActionName (..))
 
-import           Hie.Locate
 import           Hie.Cabal.Parser
-import qualified Hie.Yaml                          as Implicit
+import           Hie.Locate
+import qualified Hie.Yaml                  as Implicit
 
 loadImplicitCradle :: Show a => LogAction IO (WithSeverity Log) -> FilePath -> IO (Cradle a)
 loadImplicitCradle l wfile = do
@@ -50,11 +51,11 @@
    <|> (cabalExecutable >> cabalConfigDir start_dir >>= \dir -> cabalWorkDir dir >> pure (simpleCabalCradle dir))
    <|> (stackExecutable >> stackConfigDir start_dir >>= \dir -> stackWorkDir dir >> stackCradle dir)
    -- If we have a cabal.project OR we have a .cabal and dist-newstyle, prefer cabal
-   <|> (cabalExecutable >> (cabalConfigDir start_dir <|> cabalFileAndWorkDir) >>= pure . simpleCabalCradle)
+   <|> (cabalExecutable >> (cabalConfigDir start_dir <|> cabalFileAndWorkDir) <&> simpleCabalCradle)
    -- If we have a stack.yaml, use stack
    <|> (stackExecutable >> stackConfigDir start_dir >>= stackCradle)
    -- If we have a cabal file, use cabal
-   <|> (cabalExecutable >> cabalFileDir start_dir >>= pure . simpleCabalCradle)
+   <|> (cabalExecutable >> cabalFileDir start_dir <&> simpleCabalCradle)
 
   where
   maybeItsBios = (\wdir -> (Bios (Program $ wdir </> ".hie-bios") Nothing Nothing, wdir)) <$> biosWorkDir start_dir
diff --git a/src/Development/IDE/Core/Actions.hs b/src/Development/IDE/Core/Actions.hs
--- a/src/Development/IDE/Core/Actions.hs
+++ b/src/Development/IDE/Core/Actions.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE RankNTypes   #-}
 {-# LANGUAGE TypeFamilies #-}
 module Development.IDE.Core.Actions
 ( getAtPoint
diff --git a/src/Development/IDE/Core/Compile.hs b/src/Development/IDE/Core/Compile.hs
--- a/src/Development/IDE/Core/Compile.hs
+++ b/src/Development/IDE/Core/Compile.hs
@@ -3,7 +3,6 @@
 
 {-# LANGUAGE CPP        #-}
 {-# LANGUAGE GADTs      #-}
-{-# LANGUAGE RankNTypes #-}
 
 -- | Based on https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/API.
 --   Given a list of paths to find libraries, and a file to compile, produce a list of 'CoreModule' values.
@@ -297,8 +296,8 @@
 #endif
 
                                          | n <- concatMap (uniqDSetToList . bcoFreeNames) $ bc_bcos bcos
-                                         , Just mod <- [nameModule_maybe n] -- Names from other modules
                                          , not (isWiredInName n) -- Exclude wired-in names
+                                         , Just mod <- [nameModule_maybe n] -- Names from other modules
                                          , moduleUnitId mod `elem` home_unit_ids -- Only care about stuff from the home package set
                                          ]
                  home_unit_ids =
@@ -340,7 +339,7 @@
 #else
              {- load it -}
            ; fv_hvs <- loadDecls (hscInterp hsc_env') hsc_env' srcspan bcos
-           ; let hval = (expectJust "hscCompileCoreExpr'" $ lookup (idName binding_id) fv_hvs)
+           ; let hval = expectJust "hscCompileCoreExpr'" $ lookup (idName binding_id) fv_hvs
 #endif
 
            ; modifyIORef' var (flip extendModuleEnvList [(mi_module $ hm_iface hm, linkableHash lb) | lb <- lbs, let hm = linkableHomeMod lb])
@@ -595,7 +594,7 @@
           -- SYB is slow but fine given that this is only used for testing
           noUnfoldings = everywhere $ mkT $ \v -> if isId v
             then
-              let v' = if isOtherUnfolding (realIdUnfolding v) then (setIdUnfolding v noUnfolding) else v
+              let v' = if isOtherUnfolding (realIdUnfolding v) then setIdUnfolding v noUnfolding else v
                 in setIdOccInfo v' noOccInfo
             else v
           isOtherUnfolding (OtherCon _) = True
@@ -1256,9 +1255,9 @@
        -> FilePath  -- ^ the filename (for source locations)
        -> Util.StringBuffer -- ^ Haskell module source text (full Unicode is supported)
 #if MIN_VERSION_ghc(9,5,0)
-       -> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located(HsModule GhcPs))
+       -> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located (HsModule GhcPs))
 #else
-       -> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located(HsModule))
+       -> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located HsModule)
 #endif
 parseHeader dflags filename contents = do
    let loc  = mkRealSrcLoc (Util.mkFastString filename) 1 1
@@ -1748,19 +1747,19 @@
 
   - CPP clauses should be placed at the end of the imports section. The clauses
   should be ordered by the GHC version they target from earlier to later versions,
-  with negative if clauses coming before positive if clauses of the same 
-  version. (If you think about which GHC version a clause activates for this 
+  with negative if clauses coming before positive if clauses of the same
+  version. (If you think about which GHC version a clause activates for this
   should make sense `!MIN_VERSION_GHC(9,0,0)` refers to 8.10 and lower which is
-  a earlier version than `MIN_VERSION_GHC(9,0,0)` which refers to versions 9.0 
+  a earlier version than `MIN_VERSION_GHC(9,0,0)` which refers to versions 9.0
   and later). In addition there should be a space before and after each CPP
   clause.
 
-  - In if clauses that use `&&` and depend on more than one statement, the 
+  - In if clauses that use `&&` and depend on more than one statement, the
   positive statement should come before the negative statement. In addition the
   clause should come after the single positive clause for that GHC version.
 
-  - There shouldn't be multiple identical CPP statements. The use of odd or even 
+  - There shouldn't be multiple identical CPP statements. The use of odd or even
   GHC numbers is identical, with the only preference being to use what is
-  already there. (i.e. (`MIN_VERSION_GHC(9,2,0)` and `MIN_VERSION_GHC(9,1,0)` 
+  already there. (i.e. (`MIN_VERSION_GHC(9,2,0)` and `MIN_VERSION_GHC(9,1,0)`
   are functionally equivalent)
 -}
diff --git a/src/Development/IDE/Core/FileStore.hs b/src/Development/IDE/Core/FileStore.hs
--- a/src/Development/IDE/Core/FileStore.hs
+++ b/src/Development/IDE/Core/FileStore.hs
@@ -183,7 +183,7 @@
     time <- use_ GetModificationTime file
     res <- do
         mbVirtual <- getVirtualFile file
-        pure $ Rope.toText . _file_text <$> mbVirtual
+        pure $ virtualFileText <$> mbVirtual
     pure ([], Just (time, res))
 
 -- | Returns the modification time and the contents.
@@ -265,7 +265,7 @@
           -- our purposes.
           registration = LSP.TRegistration { _id ="globalFileWatches"
                                            , _method = LSP.SMethod_WorkspaceDidChangeWatchedFiles
-                                           , _registerOptions = Just $ regOptions}
+                                           , _registerOptions = Just regOptions}
           regOptions =
             DidChangeWatchedFilesRegistrationOptions { _watchers = watchers }
           -- See Note [File existence cache and LSP file watchers] for why this exists, and the choice of watch kind
diff --git a/src/Development/IDE/Core/OfInterest.hs b/src/Development/IDE/Core/OfInterest.hs
--- a/src/Development/IDE/Core/OfInterest.hs
+++ b/src/Development/IDE/Core/OfInterest.hs
@@ -1,8 +1,7 @@
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
 
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE TypeFamilies      #-}
+{-# LANGUAGE TypeFamilies #-}
 
 -- | Utilities and state for the files of interest - those which are currently
 --   open in the editor. The rule is 'IsFileOfInterest'
diff --git a/src/Development/IDE/Core/ProgressReporting.hs b/src/Development/IDE/Core/ProgressReporting.hs
--- a/src/Development/IDE/Core/ProgressReporting.hs
+++ b/src/Development/IDE/Core/ProgressReporting.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE RankNTypes #-}
 module Development.IDE.Core.ProgressReporting
   ( ProgressEvent(..)
   , ProgressReporting(..)
diff --git a/src/Development/IDE/Core/RuleTypes.hs b/src/Development/IDE/Core/RuleTypes.hs
--- a/src/Development/IDE/Core/RuleTypes.hs
+++ b/src/Development/IDE/Core/RuleTypes.hs
@@ -2,7 +2,6 @@
 -- SPDX-License-Identifier: Apache-2.0
 
 {-# LANGUAGE DerivingStrategies #-}
-{-# LANGUAGE FlexibleInstances  #-}
 {-# LANGUAGE GADTs              #-}
 {-# LANGUAGE PatternSynonyms    #-}
 {-# LANGUAGE TemplateHaskell    #-}
diff --git a/src/Development/IDE/Core/Rules.hs b/src/Development/IDE/Core/Rules.hs
--- a/src/Development/IDE/Core/Rules.hs
+++ b/src/Development/IDE/Core/Rules.hs
@@ -3,7 +3,6 @@
 
 {-# LANGUAGE CPP                   #-}
 {-# LANGUAGE DuplicateRecordFields #-}
-{-# LANGUAGE FlexibleInstances     #-}
 {-# LANGUAGE TypeFamilies          #-}
 
 -- | A Shake implementation of the compiler service, built
@@ -372,7 +371,7 @@
         let import_dirs = deps env_eq
         let dflags = hsc_dflags env
             isImplicitCradle = isNothing $ envImportPaths env_eq
-        dflags' <- return $ if isImplicitCradle
+        let dflags' = if isImplicitCradle
                     then addRelativeImport file (moduleName $ ms_mod ms) dflags
                     else dflags
         opt <- getIdeOptions
@@ -538,7 +537,7 @@
                   let cycles = mapMaybe (cycleErrorInFile fileId) (toList errs)
                   -- Convert cycles of files into cycles of module names
                   forM cycles $ \(imp, files) -> do
-                      modNames <- forM files $ 
+                      modNames <- forM files $
                           getModuleName . idToPath depPathIdMap
                       pure $ toDiag imp $ sort modNames
     where cycleErrorInFile f (PartOfCycle imp fs)
@@ -576,7 +575,7 @@
   vfsData <- liftIO $ _vfsMap <$> readTVarIO vfsRef
   (currentSource, ver) <- liftIO $ case M.lookup (filePathToUri' file) vfsData of
     Nothing -> (,Nothing) . T.decodeUtf8 <$> BS.readFile (fromNormalizedFilePath file)
-    Just vf -> pure (Rope.toText $ _file_text vf, Just $ _lsp_version vf)
+    Just vf -> pure (virtualFileText vf, Just $ virtualFileVersion vf)
   let refmap = Compat.generateReferencesMap . Compat.getAsts . Compat.hie_asts $ res
       del = deltaFromDiff (T.decodeUtf8 $ Compat.hie_hs_src res) currentSource
   pure (HAR (Compat.hie_module res) (Compat.hie_asts res) refmap mempty (HieFromDisk res),del,ver)
@@ -701,7 +700,7 @@
         -- 'extendModSummaryNoDeps'.
         -- This may have to change in the future.
           map extendModSummaryNoDeps $
-          (catMaybes mss)
+          catMaybes mss
 #endif
   pure (fingerprintToBS $ Util.fingerprintFingerprints $ map (maybe fingerprint0 msrFingerprint) msrs, processDependencyInformation rawDepInfo bm mg)
 
@@ -1117,16 +1116,16 @@
     HiFileResult{hirModIface, hirModDetails, hirCoreFp} <- use_ GetModIface f
     let obj_file  = ml_obj_file (ms_location ms)
         core_file = ml_core_file (ms_location ms)
-    -- Can't use `GetModificationTime` rule because the core file was possibly written in this
-    -- very session, so the results aren't reliable
-    core_t <- liftIO $ getModTime core_file
     case hirCoreFp of
-      Nothing -> error "called GetLinkable for a file without a linkable"
+      Nothing -> error $ "called GetLinkable for a file without a linkable: " ++ show f
       Just (bin_core, fileHash) -> do
         session <- use_ GhcSessionDeps f
         linkableType <- getLinkableType f >>= \case
-          Nothing -> error "called GetLinkable for a file which doesn't need compilation"
+          Nothing -> error $ "called GetLinkable for a file which doesn't need compilation: " ++ show f
           Just t -> pure t
+        -- Can't use `GetModificationTime` rule because the core file was possibly written in this
+        -- very session, so the results aren't reliable
+        core_t <- liftIO $ getModTime core_file
         (warns, hmi) <- case linkableType of
           -- Bytecode needs to be regenerated from the core file
           BCOLinkable -> liftIO $ coreFileToLinkable linkableType (hscEnv session) ms hirModIface hirModDetails bin_core (posixSecondsToUTCTime core_t)
@@ -1170,7 +1169,7 @@
 -- needsCompilationRule :: Rules ()
 needsCompilationRule :: NormalizedFilePath  -> Action (IdeResultNoDiagnosticsEarlyCutoff (Maybe LinkableType))
 needsCompilationRule file
-  | "boot" `isSuffixOf` (fromNormalizedFilePath file) =
+  | "boot" `isSuffixOf` fromNormalizedFilePath file =
     pure (Just $ encodeLinkableType Nothing, Just Nothing)
 needsCompilationRule file = do
   graph <- useNoFile GetModuleGraph
@@ -1271,7 +1270,7 @@
     reportImportCyclesRule recorder
     typeCheckRule recorder
     getDocMapRule recorder
-    loadGhcSession recorder def{fullModuleGraph}
+    loadGhcSession recorder GhcSessionDepsConfig{fullModuleGraph}
     getModIfaceFromDiskRule recorder
     getModIfaceFromDiskAndIndexRule recorder
     getModIfaceRule recorder
diff --git a/src/Development/IDE/Core/Service.hs b/src/Development/IDE/Core/Service.hs
--- a/src/Development/IDE/Core/Service.hs
+++ b/src/Development/IDE/Core/Service.hs
@@ -1,9 +1,7 @@
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
 
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE RankNTypes        #-}
-{-# LANGUAGE TypeFamilies      #-}
+{-# LANGUAGE TypeFamilies #-}
 
 -- | A Shake implementation of the compiler service, built
 --   using the "Shaker" abstraction layer for in-memory use.
diff --git a/src/Development/IDE/Core/Shake.hs b/src/Development/IDE/Core/Shake.hs
--- a/src/Development/IDE/Core/Shake.hs
+++ b/src/Development/IDE/Core/Shake.hs
@@ -1,16 +1,12 @@
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
 
-{-# LANGUAGE CPP                       #-}
-{-# LANGUAGE ConstraintKinds           #-}
-{-# LANGUAGE DerivingStrategies        #-}
-{-# LANGUAGE DuplicateRecordFields     #-}
-{-# LANGUAGE ExistentialQuantification #-}
-{-# LANGUAGE PackageImports            #-}
-{-# LANGUAGE PolyKinds                 #-}
-{-# LANGUAGE RankNTypes                #-}
-{-# LANGUAGE RecursiveDo               #-}
-{-# LANGUAGE TypeFamilies              #-}
+{-# LANGUAGE CPP                   #-}
+{-# LANGUAGE DerivingStrategies    #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE PackageImports        #-}
+{-# LANGUAGE RecursiveDo           #-}
+{-# LANGUAGE TypeFamilies          #-}
 
 -- | A Shake implementation of the compiler service.
 --
@@ -168,6 +164,7 @@
 import qualified Language.LSP.Protocol.Lens             as L
 import           Language.LSP.Protocol.Message
 import           Language.LSP.Protocol.Types
+import           Language.LSP.Protocol.Types            (SemanticTokens)
 import qualified Language.LSP.Protocol.Types            as LSP
 import qualified Language.LSP.Server                    as LSP
 import           Language.LSP.VFS                       hiding (start)
@@ -189,7 +186,7 @@
 data Log
   = LogCreateHieDbExportsMapStart
   | LogCreateHieDbExportsMapFinish !Int
-  | LogBuildSessionRestart !String ![DelayedActionInternal] !(KeySet) !Seconds !(Maybe FilePath)
+  | LogBuildSessionRestart !String ![DelayedActionInternal] !KeySet !Seconds !(Maybe FilePath)
   | LogBuildSessionRestartTakingTooLong !Seconds
   | LogDelayedAction !(DelayedAction ()) !Seconds
   | LogBuildSessionFinish !(Maybe SomeException)
@@ -247,6 +244,13 @@
 -- with (currently) retry functionality
 type IndexQueue = TQueue (((HieDb -> IO ()) -> IO ()) -> IO ())
 
+-- Note [Semantic Tokens Cache Location]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- storing semantic tokens cache for each file in shakeExtras might
+-- not be ideal, since it most used in LSP request handlers
+-- instead of rules. We should consider moving it to a more
+-- appropriate place in the future if we find one, store it for now.
+
 -- information we stash inside the shakeExtra field
 data ShakeExtras = ShakeExtras
     { --eventer :: LSP.FromServerMessage -> IO ()
@@ -263,6 +267,14 @@
     ,publishedDiagnostics :: STM.Map NormalizedUri [Diagnostic]
     -- ^ This represents the set of diagnostics that we have published.
     -- Due to debouncing not every change might get published.
+
+    ,semanticTokensCache:: STM.Map NormalizedFilePath SemanticTokens
+    -- ^ Cache of last response of semantic tokens for each file,
+    -- so we can compute deltas for semantic tokens(SMethod_TextDocumentSemanticTokensFullDelta).
+    -- putting semantic tokens cache and id in shakeExtras might not be ideal
+    -- see Note [Semantic Tokens Cache Location]
+    ,semanticTokensId :: TVar Int
+    -- ^ semanticTokensId is used to generate unique ids for each lsp response of semantic tokens.
     ,positionMapping :: STM.Map NormalizedUri (EnumMap Int32 (PositionDelta, PositionMapping))
     -- ^ Map from a text document version to a PositionMapping that describes how to map
     -- positions in a version of that document to positions in the latest version
@@ -620,12 +632,14 @@
         diagnostics <- STM.newIO
         hiddenDiagnostics <- STM.newIO
         publishedDiagnostics <- STM.newIO
+        semanticTokensCache <- STM.newIO
         positionMapping <- STM.newIO
         knownTargetsVar <- newTVarIO $ hashed HMap.empty
         let restartShakeSession = shakeRestart recorder ideState
         persistentKeys <- newTVarIO mempty
         indexPending <- newTVarIO HMap.empty
         indexCompleted <- newTVarIO 0
+        semanticTokensId <- newTVarIO 0
         indexProgressToken <- newVar Nothing
         let hiedbWriter = HieDbWriter{..}
         exportsMap <- newTVarIO mempty
@@ -1276,7 +1290,7 @@
                             liftIO $ tag "count" (show $ Prelude.length newDiags)
                             liftIO $ tag "key" (show k)
                             LSP.sendNotification SMethod_TextDocumentPublishDiagnostics $
-                                LSP.PublishDiagnosticsParams (fromNormalizedUri uri') (fmap fromIntegral ver) ( newDiags)
+                                LSP.PublishDiagnosticsParams (fromNormalizedUri uri') (fmap fromIntegral ver) newDiags
                  return action
     where
         diagsFromRule :: Diagnostic -> Diagnostic
diff --git a/src/Development/IDE/Core/UseStale.hs b/src/Development/IDE/Core/UseStale.hs
--- a/src/Development/IDE/Core/UseStale.hs
+++ b/src/Development/IDE/Core/UseStale.hs
@@ -1,7 +1,5 @@
-{-# LANGUAGE DerivingVia    #-}
-{-# LANGUAGE GADTs          #-}
-{-# LANGUAGE KindSignatures #-}
-{-# LANGUAGE RankNTypes     #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE GADTs       #-}
 
 module Development.IDE.Core.UseStale
   ( Age(..)
diff --git a/src/Development/IDE/GHC/CPP.hs b/src/Development/IDE/GHC/CPP.hs
--- a/src/Development/IDE/GHC/CPP.hs
+++ b/src/Development/IDE/GHC/CPP.hs
@@ -53,11 +53,11 @@
 #if MIN_VERSION_ghc(9,5,0)
     let cpp_opts = Pipeline.CppOpts
                  { cppLinePragmas = True
-# if MIN_VERSION_ghc(9,9,0)
+#if MIN_VERSION_ghc(9,9,0)
                  , useHsCpp = True
-# else
+#else
                  , cppUseCc = False
-# endif
+#endif
                  } in
 #else
     let cpp_opts = True in
diff --git a/src/Development/IDE/GHC/Compat.hs b/src/Development/IDE/GHC/Compat.hs
--- a/src/Development/IDE/GHC/Compat.hs
+++ b/src/Development/IDE/GHC/Compat.hs
@@ -2,22 +2,16 @@
 -- SPDX-License-Identifier: Apache-2.0
 
 {-# LANGUAGE CPP               #-}
-{-# LANGUAGE ConstraintKinds   #-}
-{-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE PatternSynonyms   #-}
-{-# OPTIONS -Wno-incomplete-uni-patterns -Wno-dodgy-imports #-}
 
 -- | Attempt at hiding the GHC version differences we can.
 module Development.IDE.GHC.Compat(
-    mkHomeModLocation,
     hPutStringBuffer,
     addIncludePathsQuote,
     getModuleHash,
     setUpTypedHoles,
     NameCacheUpdater(..),
 #if MIN_VERSION_ghc(9,3,0)
-    getMessages,
-    renderDiagnosticMessageWithHints,
     nameEnvElts,
 #else
     upNameCache,
@@ -26,10 +20,8 @@
     disableWarningsAsErrors,
     reLoc,
     reLocA,
-    getPsMessages,
     renderMessages,
     pattern PFailedWithErrorMessages,
-    isObjectLinkable,
 
 #if !MIN_VERSION_ghc(9,3,0)
     extendModSummaryNoDeps,
@@ -53,8 +45,9 @@
     nodeAnnotations,
     mkAstNode,
     combineRealSrcSpans,
-
+#if !MIN_VERSION_ghc(9,3,0)
     nonDetOccEnvElts,
+#endif
     nonDetFoldOccEnv,
 
     isQualifiedImport,
@@ -94,7 +87,9 @@
     simplifyExpr,
     tidyExpr,
     emptyTidyEnv,
+#if MIN_VERSION_ghc(9,7,0)
     tcInitTidyEnv,
+#endif
     corePrepExpr,
     corePrepPgm,
     lintInteractiveExpr,
@@ -160,11 +155,6 @@
 import qualified Data.Map                              as Map
 import qualified Data.Set                              as S
 
--- See Note [Guidelines For Using CPP In GHCIDE Import Statements]
-
-#if MIN_VERSION_ghc(9,7,0)
-import           GHC.Tc.Zonk.TcType                    (tcInitTidyEnv)
-#endif
 import qualified GHC.Core.Opt.Pipeline                 as GHC
 import           GHC.Core.Tidy                         (tidyExpr)
 import           GHC.CoreToStg.Prep                    (corePrepPgm)
@@ -187,15 +177,8 @@
 import           GHC.SysTools.Tasks                    (runUnlit, runPp)
 import qualified GHC.Types.Avail                       as Avail
 
-
-#if !MIN_VERSION_ghc(9,5,0)
-import           GHC.Core.Lint                         (lintInteractiveExpr)
-#endif
-
-
 import           GHC.Iface.Env
 import           GHC.Types.SrcLoc                      (combineRealSrcSpans)
-import           GHC.Linker.Loader                     (loadExpr)
 import           GHC.Runtime.Context                   (icInteractiveModule)
 import           GHC.Unit.Home.ModInfo                 (HomePackageTable,
                                                         lookupHpt)
@@ -205,21 +188,19 @@
 import           GHC.ByteCode.Types
 import           GHC.CoreToStg
 import           GHC.Data.Maybe
-import           GHC.Linker.Loader                     (loadDecls)
+import           GHC.Linker.Loader                     (loadDecls, loadExpr)
 import           GHC.Stg.Pipeline
 import           GHC.Stg.Syntax
 import           GHC.StgToByteCode
 import           GHC.Types.CostCentre
 import           GHC.Types.IPE
 
+-- See Note [Guidelines For Using CPP In GHCIDE Import Statements]
+
 #if !MIN_VERSION_ghc(9,3,0)
 import           GHC.Unit.Module.Deps (Dependencies(dep_mods), Usage(..))
-import           GHC.Linker.Types                      (isObjectLinkable)
 import           GHC.Unit.Module.ModSummary
 import           GHC.Runtime.Interpreter
-#endif
-
-#if !MIN_VERSION_ghc(9,3,0)
 import           Data.IORef
 #endif
 
@@ -228,6 +209,10 @@
 import GHC.Driver.Config.Stg.Pipeline
 #endif
 
+#if !MIN_VERSION_ghc(9,5,0)
+import           GHC.Core.Lint                         (lintInteractiveExpr)
+#endif
+
 #if MIN_VERSION_ghc(9,5,0)
 import           GHC.Core.Lint.Interactive                           (interactiveInScope)
 import           GHC.Driver.Config.Core.Lint.Interactive             (lintInteractiveExpr)
@@ -236,12 +221,14 @@
 import           GHC.Driver.Config.CoreToStg.Prep                    (initCorePrepConfig)
 #endif
 
+#if MIN_VERSION_ghc(9,7,0)
+import           GHC.Tc.Zonk.TcType                    (tcInitTidyEnv)
+#endif
+
 #if !MIN_VERSION_ghc(9,7,0)
 liftZonkM :: a -> a
 liftZonkM = id
-#endif
 
-#if !MIN_VERSION_ghc(9,7,0)
 nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b
 nonDetFoldOccEnv = foldOccEnv
 #endif
diff --git a/src/Development/IDE/GHC/Compat/CmdLine.hs b/src/Development/IDE/GHC/Compat/CmdLine.hs
--- a/src/Development/IDE/GHC/Compat/CmdLine.hs
+++ b/src/Development/IDE/GHC/Compat/CmdLine.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE CPP #-}
-{-# LANGUAGE RankNTypes #-}
 
 -- | Compat module Interface file relevant code.
 module Development.IDE.GHC.Compat.CmdLine (
@@ -15,12 +14,13 @@
     ) where
 
 #if MIN_VERSION_ghc(9,3,0)
-import GHC.Driver.Session (processCmdLineP, CmdLineP (..), getCmdLineState, putCmdLineState)
-import GHC.Driver.CmdLine
+import           GHC.Driver.CmdLine
+import           GHC.Driver.Session     (CmdLineP (..), getCmdLineState,
+                                         processCmdLineP, putCmdLineState)
 #else
-import GHC.Driver.CmdLine
-import Control.Monad.IO.Class
-import GHC (Located)
+import           Control.Monad.IO.Class
+import           GHC                    (Located)
+import           GHC.Driver.CmdLine
 #endif
 
 #if !MIN_VERSION_ghc(9,3,0)
diff --git a/src/Development/IDE/GHC/Compat/Core.hs b/src/Development/IDE/GHC/Compat/Core.hs
--- a/src/Development/IDE/GHC/Compat/Core.hs
+++ b/src/Development/IDE/GHC/Compat/Core.hs
@@ -1,8 +1,6 @@
 {-# LANGUAGE CPP               #-}
-{-# LANGUAGE ConstraintKinds   #-}
-{-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE PatternSynonyms   #-}
-{-# LANGUAGE ViewPatterns   #-}
+{-# LANGUAGE ViewPatterns      #-}
 
 -- | Compat Core module that handles the GHC module hierarchy re-organization
 -- by re-exporting everything we care about.
@@ -85,7 +83,6 @@
     RecompileRequired(..),
     mkPartialIface,
     mkFullIface,
-    checkOldIface,
     IsBootInterface(..),
     -- * Fixity
     LexicalFixity(..),
@@ -120,14 +117,14 @@
     pattern ConPatIn,
     conPatDetails,
     mapConPatDetail,
+#if MIN_VERSION_ghc(9,5,0)
     mkVisFunTys,
+#endif
     -- * Specs
     ImpDeclSpec(..),
     ImportSpec(..),
     -- * SourceText
     SourceText(..),
-    -- * Name
-    tyThingParent_maybe,
     -- * Ways
     Way,
     wayGeneralFlags,
@@ -168,6 +165,7 @@
     hscInteractive,
     hscSimplify,
     hscTypecheckRename,
+    hscUpdateHPT,
     Development.IDE.GHC.Compat.Core.makeSimpleDetails,
     -- * Typecheck utils
     tcSplitForAllTyVars,
@@ -176,7 +174,6 @@
     Development.IDE.GHC.Compat.Core.mkIfaceTc,
     Development.IDE.GHC.Compat.Core.mkBootModDetailsTc,
     Development.IDE.GHC.Compat.Core.initTidyOpts,
-    hscUpdateHPT,
     driverNoStop,
     tidyProgram,
     ImportedModsVal(..),
@@ -204,7 +201,6 @@
     pattern RealSrcLoc,
     SrcLoc.SrcLoc(SrcLoc.UnhelpfulLoc),
     BufSpan,
-    SrcSpanAnn',
     GHC.SrcAnn,
     SrcLoc.leftmost_smallest,
     SrcLoc.containsSpan,
@@ -236,7 +232,6 @@
     -- * Finder
     FindResult(..),
     mkHomeModLocation,
-    addBootSuffixLocnOut,
     findObjectLinkableMaybe,
     InstalledFindResult(..),
     -- * Module and Package
@@ -263,7 +258,6 @@
     Target(..),
     TargetId(..),
     mkSimpleTarget,
-    mkModuleGraph,
     -- * GHCi
     initObjLinker,
     loadDLL,
@@ -285,8 +279,6 @@
     Role(..),
     -- * Panic
     Plain.PlainGhcException,
-    panic,
-    panicDoc,
     -- * Other
     GHC.CoreModule(..),
     GHC.SafeHaskellMode(..),
@@ -321,6 +313,7 @@
     module GHC.HsToCore.Monad,
 
     module GHC.Iface.Syntax,
+    module GHC.Iface.Recomp,
 
     module GHC.Hs.Decls,
     module GHC.Hs.Expr,
@@ -344,9 +337,8 @@
 
     module GHC.Types.Basic,
     module GHC.Types.Id,
-    module GHC.Types.Name            ,
+    module GHC.Types.Name,
     module GHC.Types.Name.Set,
-
     module GHC.Types.Name.Cache,
     module GHC.Types.Name.Env,
     module GHC.Types.Name.Reader,
@@ -361,30 +353,29 @@
     module GHC.Types.Unique.Supply,
     module GHC.Types.Var,
     module GHC.Unit.Module,
+    module GHC.Unit.Module.Graph,
     -- * Syntax re-exports
     module GHC.Hs,
     module GHC.Hs.Binds,
     module GHC.Parser,
     module GHC.Parser.Header,
     module GHC.Parser.Lexer,
+    module GHC.Utils.Panic,
 #if MIN_VERSION_ghc(9,3,0)
     CompileReason(..),
     hsc_type_env_vars,
-    hscUpdateHUG, hscUpdateHPT, hsc_HUG,
+    hscUpdateHUG, hsc_HUG,
     GhcMessage(..),
     getKey,
     module GHC.Driver.Env.KnotVars,
-    module GHC.Iface.Recomp,
     module GHC.Linker.Types,
-    module GHC.Unit.Module.Graph,
     module GHC.Types.Unique.Map,
     module GHC.Utils.TmpFs,
-    module GHC.Utils.Panic,
     module GHC.Unit.Finder.Types,
     module GHC.Unit.Env,
     module GHC.Driver.Phases,
 #endif
-# if !MIN_VERSION_ghc(9,4,0)
+#if !MIN_VERSION_ghc(9,4,0)
     pattern HsFieldBind,
     hfbAnn,
     hfbLHS,
@@ -396,18 +387,20 @@
 #else
     Extension(..),
 #endif
-    UniqFM,
     mkCgInteractiveGuts,
     justBytecode,
     justObjects,
     emptyHomeModInfoLinkable,
     homeModInfoByteCode,
     homeModInfoObject,
-# if !MIN_VERSION_ghc(9,5,0)
+#if !MIN_VERSION_ghc(9,5,0)
     field_label,
 #endif
     groupOrigin,
     isVisibleFunArg,
+#if MIN_VERSION_ghc(9,8,0)
+    lookupGlobalRdrEnv
+#endif
     ) where
 
 import qualified GHC
@@ -538,7 +531,7 @@
 import           GHC.Unit.Module.Imported
 import           GHC.Unit.Module.ModDetails
 import           GHC.Unit.Module.ModGuts
-import           GHC.Unit.Module.ModIface     (IfaceExport, ModIface (..),
+import           GHC.Unit.Module.ModIface     (IfaceExport, ModIface,
                                                ModIface_ (..), mi_fix)
 import           GHC.Unit.Module.ModSummary   (ModSummary (..))
 import           Language.Haskell.Syntax hiding (FunDep)
@@ -824,4 +817,8 @@
 mkSimpleTarget df fp = Target (TargetFile fp Nothing) True (homeUnitId_ df) Nothing
 #else
 mkSimpleTarget _ fp = Target (TargetFile fp Nothing) True Nothing
+#endif
+
+#if MIN_VERSION_ghc(9,7,0)
+lookupGlobalRdrEnv gre_env occ = lookupGRE gre_env (LookupOccName occ AllRelevantGREs)
 #endif
diff --git a/src/Development/IDE/GHC/Compat/Outputable.hs b/src/Development/IDE/GHC/Compat/Outputable.hs
--- a/src/Development/IDE/GHC/Compat/Outputable.hs
+++ b/src/Development/IDE/GHC/Compat/Outputable.hs
@@ -137,11 +137,11 @@
   = sdocWithContext $ \_ctx ->
     withErrStyle unqual $
 #if MIN_VERSION_ghc(9,7,0)
-      (formatBulleted e)
+      formatBulleted e
 #elif MIN_VERSION_ghc(9,3,0)
-      (formatBulleted _ctx $ e)
+      formatBulleted _ctx $ e
 #else
-      (formatBulleted _ctx $ Error.renderDiagnostic e)
+      formatBulleted _ctx $ Error.renderDiagnostic e
 #endif
 
 
diff --git a/src/Development/IDE/GHC/Compat/Parser.hs b/src/Development/IDE/GHC/Compat/Parser.hs
--- a/src/Development/IDE/GHC/Compat/Parser.hs
+++ b/src/Development/IDE/GHC/Compat/Parser.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE CPP             #-}
 {-# LANGUAGE PatternSynonyms #-}
-{-# HLINT ignore "Unused LANGUAGE pragma" #-}
 
 -- | Parser compatibility module.
 module Development.IDE.GHC.Compat.Parser (
diff --git a/src/Development/IDE/GHC/Compat/Units.hs b/src/Development/IDE/GHC/Compat/Units.hs
--- a/src/Development/IDE/GHC/Compat/Units.hs
+++ b/src/Development/IDE/GHC/Compat/Units.hs
@@ -1,5 +1,4 @@
-{-# LANGUAGE CPP             #-}
-{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE CPP #-}
 
 -- | Compat module for 'UnitState' and 'UnitInfo'.
 module Development.IDE.GHC.Compat.Units (
diff --git a/src/Development/IDE/GHC/Compat/Util.hs b/src/Development/IDE/GHC/Compat/Util.hs
--- a/src/Development/IDE/GHC/Compat/Util.hs
+++ b/src/Development/IDE/GHC/Compat/Util.hs
@@ -1,5 +1,4 @@
-{-# LANGUAGE CPP             #-}
-{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE CPP #-}
 -- | GHC Utils and Datastructures re-exports.
 --
 -- Mainly handles module hierarchy re-organisation of GHC
diff --git a/src/Development/IDE/GHC/CoreFile.hs b/src/Development/IDE/GHC/CoreFile.hs
--- a/src/Development/IDE/GHC/CoreFile.hs
+++ b/src/Development/IDE/GHC/CoreFile.hs
@@ -1,6 +1,5 @@
-{-# LANGUAGE CPP               #-}
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE RecordWildCards   #-}
+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE RecordWildCards #-}
 
 -- | CoreFiles let us serialize Core to a file in order to later recover it
 -- without reparsing or retypechecking
@@ -124,7 +123,7 @@
 -- | Implicit binds can be generated from the interface and are not tidied,
 -- so we must filter them out
 isNotImplictBind :: CoreBind -> Bool
-isNotImplictBind bind = any (not . isImplicitId) $ bindBindings bind
+isNotImplictBind bind = not . all isImplicitId $ bindBindings bind
 
 bindBindings :: CoreBind -> [Var]
 bindBindings (NonRec b _) = [b]
@@ -189,7 +188,7 @@
           -> IfL [CoreBind]
 tcTopIfaceBindings1 ty_var ver_decls
    = do
-     int <- mapM (traverse $ tcIfaceId) ver_decls
+     int <- mapM (traverse tcIfaceId) ver_decls
      let all_ids = concatMap toList int
      liftIO $ modifyIORef ty_var (flip extendTypeEnvList $ map AnId all_ids)
      extendIfaceIdEnv all_ids $ mapM tc_iface_bindings int
@@ -212,7 +211,7 @@
   e' <- tcIfaceExpr e
   pure $ NonRec v e'
 tc_iface_bindings (TopIfaceRec vs) = do
-  vs' <- traverse (\(v, e) -> (,) <$> pure v <*> tcIfaceExpr e) vs
+  vs' <- traverse (\(v, e) -> (v,) <$> tcIfaceExpr e) vs
   pure $ Rec vs'
 
 -- | Prefixes that can occur in a GHC OccName
diff --git a/src/Development/IDE/GHC/Orphans.hs b/src/Development/IDE/GHC/Orphans.hs
--- a/src/Development/IDE/GHC/Orphans.hs
+++ b/src/Development/IDE/GHC/Orphans.hs
@@ -1,8 +1,7 @@
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
 
-{-# LANGUAGE CPP               #-}
-{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE CPP #-}
 {-# OPTIONS_GHC -Wno-orphans #-}
 
 -- | Orphan instances for GHC.
@@ -98,7 +97,7 @@
 instance NFData (SrcSpanAnn' a) where
     rnf = rwhnf
 
-instance Bifunctor (GenLocated) where
+instance Bifunctor GenLocated where
     bimap f g (L l x) = L (f l) (g x)
 
 deriving instance Functor SrcSpanAnn'
diff --git a/src/Development/IDE/GHC/Util.hs b/src/Development/IDE/GHC/Util.hs
--- a/src/Development/IDE/GHC/Util.hs
+++ b/src/Development/IDE/GHC/Util.hs
@@ -168,7 +168,7 @@
 --   Will produce an 8 byte unreadable ByteString.
 fingerprintToBS :: Fingerprint -> BS.ByteString
 fingerprintToBS (Fingerprint a b) = BS.unsafeCreate 8 $ \ptr -> do
-    ptr' <- pure $ castPtr ptr
+    let ptr' = castPtr ptr
     pokeElemOff ptr' 0 a
     pokeElemOff ptr' 1 b
 
diff --git a/src/Development/IDE/Import/FindImports.hs b/src/Development/IDE/Import/FindImports.hs
--- a/src/Development/IDE/Import/FindImports.hs
+++ b/src/Development/IDE/Import/FindImports.hs
@@ -23,9 +23,9 @@
 -- standard imports
 import           Control.Monad.Extra
 import           Control.Monad.IO.Class
-import           Data.List                         (isSuffixOf, find)
-import qualified Data.Set                          as S
+import           Data.List                         (find, isSuffixOf)
 import           Data.Maybe
+import qualified Data.Set                          as S
 import           System.FilePath
 
 -- See Note [Guidelines For Using CPP In GHCIDE Import Statements]
@@ -93,7 +93,7 @@
     Nothing ->
       case find (\(_ , _, reexports) -> S.member modName reexports) import_dirss of
         Just (uid,_,_) -> pure $ LocateFoundReexport uid
-        Nothing -> pure $ LocateNotFound
+        Nothing        -> pure LocateNotFound
     Just (uid,file) -> pure $ LocateFoundFile uid file
   where
     go (uid, candidate) = fmap ((uid,) <$>) $ targetFor modName candidate
@@ -238,7 +238,7 @@
              }
         LookupUnusable unusable ->
           let unusables' = map get_unusable unusable
-#if MIN_VERSION_ghc(9,6,4) && !MIN_VERSION_ghc(9,8,1)
+#if MIN_VERSION_ghc(9,6,4) && (!MIN_VERSION_ghc(9,8,1) || MIN_VERSION_ghc(9,8,2))
               get_unusable (m, ModUnusable r) = r
 #else
               get_unusable (m, ModUnusable r) = (moduleUnit m, r)
diff --git a/src/Development/IDE/LSP/HoverDefinition.hs b/src/Development/IDE/LSP/HoverDefinition.hs
--- a/src/Development/IDE/LSP/HoverDefinition.hs
+++ b/src/Development/IDE/LSP/HoverDefinition.hs
@@ -1,7 +1,6 @@
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
-{-# LANGUAGE GADTs      #-}
-{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE GADTs #-}
 
 -- | Display information on hover.
 module Development.IDE.LSP.HoverDefinition
diff --git a/src/Development/IDE/LSP/LanguageServer.hs b/src/Development/IDE/LSP/LanguageServer.hs
--- a/src/Development/IDE/LSP/LanguageServer.hs
+++ b/src/Development/IDE/LSP/LanguageServer.hs
@@ -1,12 +1,8 @@
       -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
 
-{-# LANGUAGE DuplicateRecordFields     #-}
-{-# LANGUAGE ExistentialQuantification #-}
-{-# LANGUAGE GADTs                     #-}
-{-# LANGUAGE PolyKinds                 #-}
-{-# LANGUAGE RankNTypes                #-}
-{-# LANGUAGE StarIsType                #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE GADTs                 #-}
 -- WARNING: A copy of DA.Daml.LanguageServer, try to keep them in sync
 -- This version removes the daml: handling
 module Development.IDE.LSP.LanguageServer
@@ -110,7 +106,7 @@
             -- TODO: magic string
             , LSP.configSection = "haskell"
             , LSP.doInitialize = doInitialize
-            , LSP.staticHandlers = (const staticHandlers)
+            , LSP.staticHandlers = const staticHandlers
             , LSP.interpretHandler = interpretHandler
             , LSP.options = modifyOptions options
             }
diff --git a/src/Development/IDE/LSP/Notifications.hs b/src/Development/IDE/LSP/Notifications.hs
--- a/src/Development/IDE/LSP/Notifications.hs
+++ b/src/Development/IDE/LSP/Notifications.hs
@@ -3,8 +3,6 @@
 
 {-# LANGUAGE DuplicateRecordFields #-}
 {-# LANGUAGE GADTs                 #-}
-{-# LANGUAGE PolyKinds             #-}
-{-# LANGUAGE RankNTypes            #-}
 
 module Development.IDE.LSP.Notifications
     ( whenUriFile
diff --git a/src/Development/IDE/LSP/Outline.hs b/src/Development/IDE/LSP/Outline.hs
--- a/src/Development/IDE/LSP/Outline.hs
+++ b/src/Development/IDE/LSP/Outline.hs
@@ -2,7 +2,6 @@
 
 {-# LANGUAGE DuplicateRecordFields #-}
 {-# LANGUAGE GADTs                 #-}
-{-# LANGUAGE RankNTypes            #-}
 
 module Development.IDE.LSP.Outline
   ( moduleOutline
@@ -191,12 +190,10 @@
     { _name   = case x of
                   ForeignImport{} -> name
                   ForeignExport{} -> name
-                  XForeignDecl{}  -> "?"
     , _kind   = SymbolKind_Object
     , _detail = case x of
                   ForeignImport{} -> Just "import"
                   ForeignExport{} -> Just "export"
-                  XForeignDecl{}  -> Nothing
     }
   where name = printOutputable $ unLoc $ fd_name x
 
@@ -274,7 +271,7 @@
     get_flds_h98 _ = []
 
     get_flds_gadt :: HsConDeclGADTDetails GhcPs
-                  -> ([LFieldOcc GhcPs])
+                  -> [LFieldOcc GhcPs]
 #if MIN_VERSION_ghc(9,3,0)
     get_flds_gadt (RecConGADT flds _) = get_flds (reLoc flds)
 #else
@@ -283,7 +280,7 @@
     get_flds_gadt _ = []
 
     get_flds :: Located [LConDeclField GhcPs]
-             -> ([LFieldOcc GhcPs])
+             -> [LFieldOcc GhcPs]
     get_flds flds = concatMap (cd_fld_names . unLoc) (unLoc flds)
 
 
diff --git a/src/Development/IDE/LSP/Server.hs b/src/Development/IDE/LSP/Server.hs
--- a/src/Development/IDE/LSP/Server.hs
+++ b/src/Development/IDE/LSP/Server.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE FlexibleInstances    #-}
 {-# LANGUAGE UndecidableInstances #-}
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
diff --git a/src/Development/IDE/Main.hs b/src/Development/IDE/Main.hs
--- a/src/Development/IDE/Main.hs
+++ b/src/Development/IDE/Main.hs
@@ -1,5 +1,4 @@
 {-# OPTIONS_GHC -Wno-orphans #-}
-{-# LANGUAGE RankNTypes #-}
 module Development.IDE.Main
 (Arguments(..)
 ,defaultArguments
diff --git a/src/Development/IDE/Main/HeapStats.hs b/src/Development/IDE/Main/HeapStats.hs
--- a/src/Development/IDE/Main/HeapStats.hs
+++ b/src/Development/IDE/Main/HeapStats.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE NumericUnderscores #-}
 -- | Logging utilities for reporting heap statistics
 module Development.IDE.Main.HeapStats ( withHeapStats, Log(..)) where
 
diff --git a/src/Development/IDE/Plugin/Completions.hs b/src/Development/IDE/Plugin/Completions.hs
--- a/src/Development/IDE/Plugin/Completions.hs
+++ b/src/Development/IDE/Plugin/Completions.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE CPP              #-}
 {-# LANGUAGE OverloadedLabels #-}
-{-# LANGUAGE RankNTypes       #-}
 {-# LANGUAGE TypeFamilies     #-}
 
 module Development.IDE.Plugin.Completions
diff --git a/src/Development/IDE/Plugin/Completions/Logic.hs b/src/Development/IDE/Plugin/Completions/Logic.hs
--- a/src/Development/IDE/Plugin/Completions/Logic.hs
+++ b/src/Development/IDE/Plugin/Completions/Logic.hs
@@ -62,7 +62,7 @@
 import           Text.Fuzzy.Parallel                      (Scored (score),
                                                            original)
 
-import qualified Data.Text.Utf16.Rope                     as Rope
+import qualified Data.Text.Utf16.Rope.Mixed               as Rope
 import           Development.IDE                          hiding (line)
 
 import           Development.IDE.Spans.AtPoint            (pointCommand)
@@ -704,7 +704,7 @@
               pn = showForSnippet name
               ty = showForSnippet <$> typ
               thisModName = Local $ nameSrcSpan name
-              dets = NameDetails <$> (nameModule_maybe name) <*> pure (nameOccName name)
+              dets = NameDetails <$> nameModule_maybe name <*> pure (nameOccName name)
 
           -- When record-dot-syntax completions are available, we return them exclusively.
           -- They are only available when we write i.e. `myrecord.` with OverloadedRecordDot enabled.
@@ -762,7 +762,7 @@
     EQ ->
       -- preserve completions for duplicate record fields where the only difference is in the type
       -- remove redundant completions with less type info than the previous
-      if (isLocalCompletion unique)
+      if isLocalCompletion unique
         -- filter global completions when we already have a local one
         || not(isLocalCompletion candidate) && isLocalCompletion unique
         then EQ
@@ -904,7 +904,7 @@
             lastMaybe = headMaybe . reverse
 
         -- grab the entire line the cursor is at
-        curLine <- headMaybe $ T.lines $ Rope.toText
+        curLine <- headMaybe $ Rope.lines
                              $ fst $ Rope.splitAtLine 1 $ snd $ Rope.splitAtLine (fromIntegral l) ropetext
         let beforePos = T.take (fromIntegral c) curLine
         -- the word getting typed, after previous space and before cursor
diff --git a/src/Development/IDE/Plugin/HLS.hs b/src/Development/IDE/Plugin/HLS.hs
--- a/src/Development/IDE/Plugin/HLS.hs
+++ b/src/Development/IDE/Plugin/HLS.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE DataKinds         #-}
 {-# LANGUAGE GADTs             #-}
 {-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PolyKinds         #-}
 
 module Development.IDE.Plugin.HLS
     (
@@ -178,7 +177,7 @@
 
     -- The parameters to the HLS command are always the first element
     execCmd :: IdeState -> ExecuteCommandParams -> LSP.LspT Config IO (Either ResponseError (A.Value |? Null))
-    execCmd ide (ExecuteCommandParams _ cmdId args) = do
+    execCmd ide (ExecuteCommandParams mtoken cmdId args) = do
       let cmdParams :: A.Value
           cmdParams = case args of
             Just ((x:_)) -> x
@@ -202,15 +201,15 @@
             A.Error _str -> return $ Right $ InR Null
 
         -- Just an ordinary HIE command
-        Just (plugin, cmd) -> runPluginCommand ide plugin cmd cmdParams
+        Just (plugin, cmd) -> runPluginCommand ide plugin cmd mtoken cmdParams
 
         -- Couldn't parse the command identifier
         _ -> do
             logWith recorder Warning LogInvalidCommandIdentifier
             return $ Left $ ResponseError (InR ErrorCodes_InvalidParams) "Invalid command identifier" Nothing
 
-    runPluginCommand :: IdeState -> PluginId -> CommandId -> A.Value -> LSP.LspT Config IO (Either ResponseError (A.Value |? Null))
-    runPluginCommand ide p com arg =
+    runPluginCommand :: IdeState -> PluginId -> CommandId -> Maybe ProgressToken -> A.Value -> LSP.LspT Config IO (Either ResponseError (A.Value |? Null))
+    runPluginCommand ide p com mtoken arg =
       case Map.lookup p pluginMap  of
         Nothing -> logAndReturnError recorder p (InR ErrorCodes_InvalidRequest) (pluginDoesntExist p)
         Just xs -> case List.find ((com ==) . commandId) xs of
@@ -218,7 +217,7 @@
           Just (PluginCommand _ _ f) -> case A.fromJSON arg of
             A.Error err -> logAndReturnError recorder p (InR ErrorCodes_InvalidParams) (failedToParseArgs com p err arg)
             A.Success a -> do
-              res <- runExceptT (f ide a) `catchAny` -- See Note [Exception handling in plugins]
+              res <- runExceptT (f ide mtoken a) `catchAny` -- See Note [Exception handling in plugins]
                 (\e -> pure $ Left $ PluginInternalError (exceptionInPlugin p SMethod_WorkspaceExecuteCommand e))
               case res of
                 (Left (PluginRequestRefused r)) ->
diff --git a/src/Development/IDE/Plugin/Test.hs b/src/Development/IDE/Plugin/Test.hs
--- a/src/Development/IDE/Plugin/Test.hs
+++ b/src/Development/IDE/Plugin/Test.hs
@@ -2,7 +2,6 @@
 {-# LANGUAGE DerivingStrategies #-}
 {-# LANGUAGE GADTs              #-}
 {-# LANGUAGE PackageImports     #-}
-{-# LANGUAGE PolyKinds          #-}
 -- | A plugin that adds custom messages for use in tests
 module Development.IDE.Plugin.Test
   ( TestRequest(..)
@@ -171,7 +170,7 @@
 }
 
 blockCommandHandler :: CommandFunction state ExecuteCommandParams
-blockCommandHandler _ideState _params = do
+blockCommandHandler _ideState _ _params = do
   lift $ LSP.sendNotification (SMethod_CustomMethod (Proxy @"ghcide/blocking/command")) A.Null
   liftIO $ threadDelay maxBound
   pure $ InR Null
diff --git a/src/Development/IDE/Plugin/TypeLenses.hs b/src/Development/IDE/Plugin/TypeLenses.hs
--- a/src/Development/IDE/Plugin/TypeLenses.hs
+++ b/src/Development/IDE/Plugin/TypeLenses.hs
@@ -183,7 +183,7 @@
 
 generateLensCommand :: PluginId -> Uri -> T.Text -> TextEdit -> Command
 generateLensCommand pId uri title edit =
-  let wEdit = WorkspaceEdit (Just $ Map.singleton uri $ [edit]) Nothing Nothing
+  let wEdit = WorkspaceEdit (Just $ Map.singleton uri [edit]) Nothing Nothing
   in mkLspCommand pId (CommandId typeLensCommandId) title (Just [toJSON wEdit])
 
 -- Since the lenses are created with diagnostics, and since the globalTypeSig
@@ -192,7 +192,7 @@
 -- recompute the edit upon command. Hence the command here just takes a edit
 -- and applies it.
 commandHandler :: CommandFunction IdeState WorkspaceEdit
-commandHandler _ideState wedit = do
+commandHandler _ideState _ wedit = do
   _ <- lift $ LSP.sendRequest SMethod_WorkspaceApplyEdit (ApplyWorkspaceEditParams Nothing wedit) (\_ -> pure ())
   pure $ InR Null
 
diff --git a/src/Development/IDE/Spans/AtPoint.hs b/src/Development/IDE/Spans/AtPoint.hs
--- a/src/Development/IDE/Spans/AtPoint.hs
+++ b/src/Development/IDE/Spans/AtPoint.hs
@@ -1,10 +1,8 @@
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
 
-{-# LANGUAGE CPP                 #-}
-{-# LANGUAGE GADTs               #-}
-{-# LANGUAGE RankNTypes          #-}
-{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE CPP   #-}
+{-# LANGUAGE GADTs #-}
 
 -- | Gives information about symbols at a given point in DAML files.
 -- These are all pure functions that should execute quickly.
@@ -97,10 +95,10 @@
           adjustedLocs = HM.foldr go [] asts
           go (HAR _ _ rf tr _, goMapping) xs = refs ++ typerefs ++ xs
             where
-              refs = mapMaybe (toCurrentLocation goMapping . realSrcSpanToLocation . fst)
-                   $ concat $ mapMaybe (\n -> M.lookup (Right n) rf) names
-              typerefs = mapMaybe (toCurrentLocation goMapping . realSrcSpanToLocation)
-                   $ concat $ mapMaybe (`M.lookup` tr) names
+              refs = concatMap (mapMaybe (toCurrentLocation goMapping . realSrcSpanToLocation . fst))
+                               (mapMaybe (\n -> M.lookup (Right n) rf) names)
+              typerefs = concatMap (mapMaybe (toCurrentLocation goMapping . realSrcSpanToLocation))
+                                   (mapMaybe (`M.lookup` tr) names)
         in (names, adjustedLocs,map fromNormalizedFilePath $ HM.keys asts)
 
 getNamesAtPoint :: HieASTs a -> Position -> PositionMapping -> [Name]
@@ -441,10 +439,10 @@
 
 pointCommand :: HieASTs t -> Position -> (HieAST t -> a) -> [a]
 pointCommand hf pos k =
-    catMaybes $ M.elems $ flip M.mapWithKey (getAsts hf) $ \fs ast ->
+    M.elems $ flip M.mapMaybeWithKey (getAsts hf) $ \fs ast ->
       -- Since GHC 9.2:
       -- getAsts :: Map HiePath (HieAst a)
-      -- type HiePath = LexialFastString
+      -- type HiePath = LexicalFastString
       --
       -- but before:
       -- getAsts :: Map HiePath (HieAst a)
diff --git a/src/Development/IDE/Spans/Documentation.hs b/src/Development/IDE/Spans/Documentation.hs
--- a/src/Development/IDE/Spans/Documentation.hs
+++ b/src/Development/IDE/Spans/Documentation.hs
@@ -1,8 +1,7 @@
-{-# LANGUAGE RankNTypes #-}
 -- Copyright (c) 2019 The DAML Authors. All rights reserved.
 -- SPDX-License-Identifier: Apache-2.0
 
-{-# LANGUAGE CPP        #-}
+{-# LANGUAGE CPP #-}
 
 module Development.IDE.Spans.Documentation (
     getDocumentation
diff --git a/src/Development/IDE/Types/Exports.hs b/src/Development/IDE/Types/Exports.hs
--- a/src/Development/IDE/Types/Exports.hs
+++ b/src/Development/IDE/Types/Exports.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE DeriveAnyClass     #-}
 {-# LANGUAGE DerivingStrategies #-}
-{-# LANGUAGE RankNTypes         #-}
 module Development.IDE.Types.Exports
 (
     IdentInfo(..),
diff --git a/src/Development/IDE/Types/Options.hs b/src/Development/IDE/Types/Options.hs
--- a/src/Development/IDE/Types/Options.hs
+++ b/src/Development/IDE/Types/Options.hs
@@ -2,7 +2,6 @@
 -- SPDX-License-Identifier: Apache-2.0
 
 -- | Options
-{-# LANGUAGE RankNTypes #-}
 module Development.IDE.Types.Options
   ( IdeOptions(..)
   , IdePreprocessedSource(..)
diff --git a/src/Development/IDE/Types/Shake.hs b/src/Development/IDE/Types/Shake.hs
--- a/src/Development/IDE/Types/Shake.hs
+++ b/src/Development/IDE/Types/Shake.hs
@@ -1,8 +1,6 @@
-{-# LANGUAGE DerivingStrategies        #-}
-{-# LANGUAGE ExistentialQuantification #-}
-{-# LANGUAGE PatternSynonyms           #-}
-{-# LANGUAGE RankNTypes                #-}
-{-# LANGUAGE TypeFamilies              #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE PatternSynonyms    #-}
+{-# LANGUAGE TypeFamilies       #-}
 module Development.IDE.Types.Shake
   ( Q (..),
     A (..),
@@ -26,7 +24,8 @@
 import           Data.Vector                          (Vector)
 import           Development.IDE.Core.PositionMapping
 import           Development.IDE.Core.RuleTypes       (FileVersion)
-import           Development.IDE.Graph                (Key (..), RuleResult, newKey)
+import           Development.IDE.Graph                (Key, RuleResult, newKey,
+                                                       pattern Key)
 import qualified Development.IDE.Graph                as Shake
 import           Development.IDE.Types.Diagnostics
 import           Development.IDE.Types.Location
diff --git a/src/Generics/SYB/GHC.hs b/src/Generics/SYB/GHC.hs
--- a/src/Generics/SYB/GHC.hs
+++ b/src/Generics/SYB/GHC.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE DerivingVia #-}
-{-# LANGUAGE RankNTypes  #-}
 
 -- | Custom SYB traversals explicitly designed for operating over the GHC AST.
 module Generics.SYB.GHC
diff --git a/test/exe/ClientSettingsTests.hs b/test/exe/ClientSettingsTests.hs
--- a/test/exe/ClientSettingsTests.hs
+++ b/test/exe/ClientSettingsTests.hs
@@ -21,7 +21,6 @@
 tests = testGroup "client settings handling"
     [ testSession "ghcide restarts shake session on config changes" $ do
             setIgnoringLogNotifications False
-            void $ skipManyTill anyMessage $ message SMethod_ClientRegisterCapability
             void $ createDoc "A.hs" "haskell" "module A where"
             waitForProgressDone
             setConfigSection "haskell" $ toJSON (def :: Config)
diff --git a/test/exe/CodeLensTests.hs b/test/exe/CodeLensTests.hs
--- a/test/exe/CodeLensTests.hs
+++ b/test/exe/CodeLensTests.hs
@@ -12,7 +12,6 @@
 import           Data.Tuple.Extra
 import           Development.IDE.GHC.Compat      (GhcVersion (..), ghcVersion)
 import qualified Language.LSP.Protocol.Lens      as L
-import           Language.LSP.Protocol.Message
 import           Language.LSP.Protocol.Types     hiding
                                                  (SemanticTokenAbsolute (..),
                                                   SemanticTokenRelative (..),
diff --git a/test/exe/CompletionTests.hs b/test/exe/CompletionTests.hs
--- a/test/exe/CompletionTests.hs
+++ b/test/exe/CompletionTests.hs
@@ -550,7 +550,6 @@
       test doc (Position 1 7) "id" (Just $ T.length expected) [expected]
   ]
   where
-    brokenForGhc9 = knownBrokenFor (BrokenForGHC [GHC90, GHC92, GHC94, GHC96]) "Completion doc doesn't support ghc9"
     brokenForWinGhc90 = knownBrokenFor (BrokenSpecific Windows [GHC90]) "Extern doc doesn't support Windows for ghc9.2"
     -- https://gitlab.haskell.org/ghc/ghc/-/issues/20903
     brokenForMacGhc9 = knownBrokenFor (BrokenSpecific MacOS [GHC90, GHC92, GHC94, GHC96]) "Extern doc doesn't support MacOS for ghc9"
diff --git a/test/exe/DiagnosticTests.hs b/test/exe/DiagnosticTests.hs
--- a/test/exe/DiagnosticTests.hs
+++ b/test/exe/DiagnosticTests.hs
@@ -31,7 +31,7 @@
 import           System.Directory
 import           System.FilePath
 import           System.IO.Extra                 hiding (withTempDir)
--- import Test.QuickCheck.Instances ()
+
 import           Control.Lens                    ((^.))
 import           Control.Monad.Extra             (whenJust)
 import           Development.IDE.Plugin.Test     (WaitForIdeRuleResult (..))
diff --git a/test/exe/ExceptionTests.hs b/test/exe/ExceptionTests.hs
--- a/test/exe/ExceptionTests.hs
+++ b/test/exe/ExceptionTests.hs
@@ -65,7 +65,7 @@
               plugins = pluginDescToIdePlugins $
                   [ (defaultPluginDescriptor pluginId "")
                       { pluginCommands =
-                          [ PluginCommand commandId "Causes an exception" $ \_ (_::Int) -> do
+                          [ PluginCommand commandId "Causes an exception" $ \_ _ (_::Int) -> do
                               _ <- liftIO $ throwIO DivideByZero
                               pure (InR Null)
                           ]
diff --git a/test/exe/FindDefinitionAndHoverTests.hs b/test/exe/FindDefinitionAndHoverTests.hs
--- a/test/exe/FindDefinitionAndHoverTests.hs
+++ b/test/exe/FindDefinitionAndHoverTests.hs
@@ -22,7 +22,7 @@
 import           Language.LSP.Test
 import           System.FilePath
 import           System.Info.Extra              (isWindows)
--- import Test.QuickCheck.Instances ()
+
 import           Control.Lens                   ((^.))
 import           Test.Tasty
 import           Test.Tasty.HUnit
@@ -240,7 +240,7 @@
         yes    = Just -- test should run and pass
         broken = Just . (`xfail` "known broken")
         no = const Nothing -- don't run this test at all
-        skip = const Nothing -- unreliable, don't run
+        --skip = const Nothing -- unreliable, don't run
 
 checkFileCompiles :: FilePath -> Session () -> TestTree
 checkFileCompiles fp diag =
diff --git a/test/exe/HieDbRetry.hs b/test/exe/HieDbRetry.hs
--- a/test/exe/HieDbRetry.hs
+++ b/test/exe/HieDbRetry.hs
@@ -44,7 +44,6 @@
 isErrorCall :: ErrorCall -> Maybe ErrorCall
 isErrorCall e
   | ErrorCall _ <- e = Just e
-  | otherwise = Nothing
 
 tests :: TestTree
 tests = testGroup "RetryHieDb"
diff --git a/test/exe/HighlightTests.hs b/test/exe/HighlightTests.hs
--- a/test/exe/HighlightTests.hs
+++ b/test/exe/HighlightTests.hs
@@ -3,7 +3,7 @@
 
 import           Control.Monad.IO.Class         (liftIO)
 import qualified Data.Text                      as T
-import           Development.IDE.GHC.Compat     (GhcVersion (..), ghcVersion)
+import           Development.IDE.GHC.Compat     (GhcVersion (..))
 import           Development.IDE.Types.Location
 import           Language.LSP.Protocol.Types    hiding
                                                 (SemanticTokenAbsolute (..),
diff --git a/test/exe/InitializeResponseTests.hs b/test/exe/InitializeResponseTests.hs
--- a/test/exe/InitializeResponseTests.hs
+++ b/test/exe/InitializeResponseTests.hs
@@ -17,7 +17,7 @@
                                                     SemanticTokensEdit (..),
                                                     mkRange)
 import           Language.LSP.Test
--- import Test.QuickCheck.Instances ()
+
 import           Control.Lens                      ((^.))
 import           Development.IDE.Plugin.Test       (blockCommandId)
 import           Test.Tasty
@@ -36,29 +36,29 @@
   tests getInitializeResponse =
     testGroup "initialize response capabilities"
     [ chk "   text doc sync"             _textDocumentSync  tds
-    , chk "   hover"                         _hoverProvider (Just $ InL True)
-    , chk "   completion"               _completionProvider (Just $ CompletionOptions Nothing (Just ["."]) Nothing (Just True) Nothing)
+    , chk "   hover"                         _hoverProvider (Just $ InR (HoverOptions (Just False)))
+    , chk "   completion"               _completionProvider (Just $ CompletionOptions (Just False) (Just ["."]) Nothing (Just True) Nothing)
     , chk "NO signature help"        _signatureHelpProvider Nothing
-    , chk "   goto definition"          _definitionProvider (Just $ InL True)
-    , chk "   goto type definition" _typeDefinitionProvider (Just $ InL True)
+    , chk "   goto definition"          _definitionProvider (Just $ InR (DefinitionOptions (Just False)))
+    , chk "   goto type definition" _typeDefinitionProvider (Just $ InR (InL (TypeDefinitionOptions (Just False))))
     -- BUG in lsp-test, this test fails, just change the accepted response
     -- for now
-    , chk "NO goto implementation"  _implementationProvider (Just $ InL False)
-    , chk "   find references"          _referencesProvider (Just $ InL True)
-    , chk "   doc highlight"     _documentHighlightProvider (Just $ InL True)
-    , chk "   doc symbol"           _documentSymbolProvider (Just $ InL True)
-    , chk "   workspace symbol"    _workspaceSymbolProvider (Just $ InL True)
-    , chk "   code action"             _codeActionProvider  (Just $ InL False)
+    , chk "NO goto implementation"  _implementationProvider Nothing
+    , chk "   find references"          _referencesProvider (Just $ InR (ReferenceOptions (Just False)))
+    , chk "   doc highlight"     _documentHighlightProvider (Just $ InR (DocumentHighlightOptions (Just False)))
+    , chk "   doc symbol"           _documentSymbolProvider (Just $ InR (DocumentSymbolOptions (Just False) Nothing))
+    , chk "   workspace symbol"    _workspaceSymbolProvider (Just $ InR (WorkspaceSymbolOptions (Just False) (Just False)))
+    , chk "NO code action"             _codeActionProvider  Nothing
     , chk "   code lens"                 _codeLensProvider  (Just $ CodeLensOptions (Just False) (Just True))
-    , chk "NO doc formatting"   _documentFormattingProvider (Just $ InL False)
+    , chk "NO doc formatting"   _documentFormattingProvider Nothing
     , chk "NO doc range formatting"
-                           _documentRangeFormattingProvider (Just $ InL False)
+                           _documentRangeFormattingProvider Nothing
     , chk "NO doc formatting on typing"
                           _documentOnTypeFormattingProvider Nothing
-    , chk "NO renaming"                     _renameProvider (Just $ InL False)
+    , chk "NO renaming"                     _renameProvider Nothing
     , chk "NO doc link"               _documentLinkProvider Nothing
-    , chk "NO color"                   (^. L.colorProvider) (Just $ InL False)
-    , chk "NO folding range"          _foldingRangeProvider (Just $ InL False)
+    , chk "NO color"                   (^. L.colorProvider) Nothing
+    , chk "NO folding range"          _foldingRangeProvider Nothing
     , che "   execute command"      _executeCommandProvider [typeLensCommandId, blockCommandId]
     , chk "   workspace"                   (^. L.workspace) (Just $ #workspaceFolders .== Just WorkspaceFoldersServerCapabilities{_supported = Just True, _changeNotifications = Just ( InR True )}
                                                                  .+ #fileOperations   .== Nothing)
@@ -77,13 +77,13 @@
         testCase title $ getInitializeResponse >>= \ir -> expected @=? (getActual . innerCaps) ir
 
       che :: TestName -> (ServerCapabilities -> Maybe ExecuteCommandOptions) -> [T.Text] -> TestTree
-      che title getActual expected = testCase title doTest
-        where
-            doTest = do
-                ir <- getInitializeResponse
-                let Just ExecuteCommandOptions {_commands = commands} = getActual $ innerCaps ir
-                    commandNames = (!! 2) . T.splitOn ":" <$> commands
-                zipWithM_ (\e o -> T.isSuffixOf e o @? show (e,o)) (sort expected) (sort commandNames)
+      che title getActual expected = testCase title $ do
+        ir <- getInitializeResponse
+        ExecuteCommandOptions {_commands = commands} <- case getActual $ innerCaps ir of
+          Just eco -> pure eco
+          Nothing -> assertFailure "Was expecting Just ExecuteCommandOptions, got Nothing"
+        let commandNames = (!! 2) . T.splitOn ":" <$> commands
+        zipWithM_ (\e o -> T.isSuffixOf e o @? show (e,o)) (sort expected) (sort commandNames)
 
   innerCaps :: TResponseMessage Method_Initialize -> ServerCapabilities
   innerCaps (TResponseMessage _ _ (Right (InitializeResult c _))) = c
@@ -93,5 +93,5 @@
   acquire = run initializeResponse
 
   release :: TResponseMessage Method_Initialize -> IO ()
-  release = const $ pure ()
+  release = mempty
 
diff --git a/test/exe/PositionMappingTests.hs b/test/exe/PositionMappingTests.hs
--- a/test/exe/PositionMappingTests.hs
+++ b/test/exe/PositionMappingTests.hs
@@ -6,8 +6,8 @@
 import qualified Data.EnumMap.Strict                  as EM
 import           Data.Row
 import qualified Data.Text                            as T
-import           Data.Text.Utf16.Rope                 (Rope)
-import qualified Data.Text.Utf16.Rope                 as Rope
+import           Data.Text.Utf16.Rope.Mixed           (Rope)
+import qualified Data.Text.Utf16.Rope.Mixed           as Rope
 import           Development.IDE.Core.PositionMapping (PositionResult (..),
                                                        fromCurrent,
                                                        positionResultToMaybe,
diff --git a/test/exe/Progress.hs b/test/exe/Progress.hs
--- a/test/exe/Progress.hs
+++ b/test/exe/Progress.hs
@@ -38,7 +38,7 @@
             model state $ \st -> recordProgress st key change
         model stateModelIO k = do
             state <- fromModel =<< stateModelIO
-            k state
+            _ <- k state
             toModel state
         test name p = testCase name $ do
             InProgressModel{..} <- p
diff --git a/test/exe/TestUtils.hs b/test/exe/TestUtils.hs
--- a/test/exe/TestUtils.hs
+++ b/test/exe/TestUtils.hs
@@ -1,14 +1,13 @@
 
 {-# LANGUAGE GADTs           #-}
 {-# LANGUAGE PatternSynonyms #-}
-{-# LANGUAGE TypeOperators   #-}
 
 module TestUtils where
 
 import           Control.Applicative.Combinators
 import           Control.Concurrent.Async
-import           Control.Exception               (bracket_, finally, throw)
-import           Control.Lens                    ((.~), (^.))
+import           Control.Exception               (bracket_, finally)
+import           Control.Lens                    ((.~))
 import qualified Control.Lens                    as Lens
 import qualified Control.Lens.Extras             as Lens
 import           Control.Monad
@@ -48,8 +47,6 @@
 
 import           LogType
 
-import           Data.Traversable                (for)
-
 -- | Wait for the next progress begin step
 waitForProgressBegin :: Session ()
 waitForProgressBegin = skipManyTill anyMessage $ satisfyMaybe $ \case
@@ -293,7 +290,7 @@
 
   assertOneDefinitionFound :: [Location] -> Session Location
   assertOneDefinitionFound [def] = pure def
-  assertOneDefinitionFound _ = liftIO $ assertFailure "Expecting exactly one definition"
+  assertOneDefinitionFound xs = liftIO . assertFailure $ "Expecting exactly one definition, got " <> show (length xs)
 
   assertRangeCorrect Location{_range = foundRange} expectedRange =
     liftIO $ expectedRange @=? foundRange
diff --git a/test/exe/WatchedFileTests.hs b/test/exe/WatchedFileTests.hs
--- a/test/exe/WatchedFileTests.hs
+++ b/test/exe/WatchedFileTests.hs
@@ -1,6 +1,5 @@
 
-{-# LANGUAGE GADTs     #-}
-{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE GADTs #-}
 
 module WatchedFileTests (tests) where
 
@@ -29,6 +28,7 @@
     [ testSession' "workspace files" $ \sessionDir -> do
         liftIO $ writeFile (sessionDir </> "hie.yaml") "cradle: {direct: {arguments: [\"-isrc\", \"A\", \"WatchedFilesMissingModule\"]}}"
         _doc <- createDoc "A.hs" "haskell" "{-#LANGUAGE NoImplicitPrelude #-}\nmodule A where\nimport WatchedFilesMissingModule"
+        setIgnoringRegistrationRequests False
         watchedFileRegs <- getWatchedFilesSubscriptionsUntil SMethod_TextDocumentPublishDiagnostics
 
         -- Expect 2 subscriptions: one for all .hs files and one for the hie.yaml cradle
@@ -39,6 +39,7 @@
         let yaml = "cradle: {direct: {arguments: [\"-i" <> tail(init(show tmpDir)) <> "\", \"A\", \"WatchedFilesMissingModule\"]}}"
         liftIO $ writeFile (sessionDir </> "hie.yaml") yaml
         _doc <- createDoc "A.hs" "haskell" "{-# LANGUAGE NoImplicitPrelude#-}\nmodule A where\nimport WatchedFilesMissingModule"
+        setIgnoringRegistrationRequests False
         watchedFileRegs <- getWatchedFilesSubscriptionsUntil SMethod_TextDocumentPublishDiagnostics
 
         -- Expect 2 subscriptions: one for all .hs files and one for the hie.yaml cradle
diff --git a/test/src/Development/IDE/Test.hs b/test/src/Development/IDE/Test.hs
--- a/test/src/Development/IDE/Test.hs
+++ b/test/src/Development/IDE/Test.hs
@@ -4,7 +4,6 @@
 {-# LANGUAGE DataKinds             #-}
 {-# LANGUAGE DuplicateRecordFields #-}
 {-# LANGUAGE GADTs                 #-}
-{-# LANGUAGE PolyKinds             #-}
 
 module Development.IDE.Test
   ( Cursor
