Skip to content

Cleanup CPPs, begin deprecation of GHC 9.4 #4567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/supported-ghc-versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["9.12", "9.10", "9.8", "9.6", "9.4"]
["9.12", "9.10", "9.8", "9.6"]
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ homepage:
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.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8
tested-with: GHC == {9.12.2, 9.10.1, 9.8.4, 9.6.7}
extra-source-files:
CHANGELOG.md
README.md
Expand Down
36 changes: 0 additions & 36 deletions ghcide/src/Development/IDE/GHC/Orphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ import GHC.Types.SrcLoc

-- See Note [Guidelines For Using CPP In GHCIDE Import Statements]

#if MIN_VERSION_ghc(9,5,0)
import GHC.Unit.Home.ModInfo
import GHC.Unit.Module.Location (ModLocation (..))
import GHC.Unit.Module.WholeCoreBindings
#endif

-- Orphan instance for Shake.hs
-- https://hub.darcs.net/ross/transformers/issue/86
Expand Down Expand Up @@ -68,13 +66,10 @@ instance NFData Unlinked where
rnf (DotA f) = rnf f
rnf (DotDLL f) = rnf f
rnf (BCOs a b) = seqCompiledByteCode a `seq` liftRnf rwhnf b
#if MIN_VERSION_ghc(9,5,0)
rnf (CoreBindings wcb) = rnf wcb
rnf (LoadedBCOs us) = rnf us
#endif
#endif

#if MIN_VERSION_ghc(9,5,0)
instance NFData WholeCoreBindings where
#if MIN_VERSION_ghc(9,11,0)
rnf (WholeCoreBindings bs m ml f) = rnf bs `seq` rnf m `seq` rnf ml `seq` rnf f
Expand All @@ -88,7 +83,6 @@ instance NFData ModLocation where
#else
rnf (ModLocation mf f1 f2 f3 f4 f5) = rnf mf `seq` rnf f1 `seq` rnf f2 `seq` rnf f3 `seq` rnf f4 `seq` rnf f5
#endif
#endif

instance Show PackageFlag where show = unpack . printOutputable
instance Show InteractiveImport where show = unpack . printOutputable
Expand All @@ -103,12 +97,6 @@ instance NFData SB.StringBuffer where rnf = rwhnf
instance Show Module where
show = moduleNameString . moduleName


#if !MIN_VERSION_ghc(9,5,0)
instance (NFData l, NFData e) => NFData (GenLocated l e) where
rnf (L l e) = rnf l `seq` rnf e
#endif

instance Show ModSummary where
show = show . ms_mod

Expand Down Expand Up @@ -191,11 +179,6 @@ instance NFData Type where
instance Show a => Show (Bag a) where
show = show . bagToList

#if !MIN_VERSION_ghc(9,5,0)
instance NFData HsDocString where
rnf = rwhnf
#endif

instance Show ModGuts where
show _ = "modguts"
instance NFData ModGuts where
Expand All @@ -204,11 +187,7 @@ instance NFData ModGuts where
instance NFData (ImportDecl GhcPs) where
rnf = rwhnf

#if MIN_VERSION_ghc(9,5,0)
instance (NFData (HsModule a)) where
#else
instance (NFData HsModule) where
#endif
rnf = rwhnf

instance Show OccName where show = unpack . printOutputable
Expand Down Expand Up @@ -239,10 +218,8 @@ instance NFData UnitId where
instance NFData NodeKey where
rnf = rwhnf

#if MIN_VERSION_ghc(9,5,0)
instance NFData HomeModLinkable where
rnf = rwhnf
#endif

instance NFData (HsExpr (GhcPass Renamed)) where
rnf = rwhnf
Expand All @@ -261,16 +238,3 @@ instance NFData Extension where

instance NFData (UniqFM Name [Name]) where
rnf (ufmToIntMap -> m) = rnf m

#if !MIN_VERSION_ghc(9,5,0)
instance NFData DuplicateRecordFields where
rnf DuplicateRecordFields = ()
rnf NoDuplicateRecordFields = ()

instance NFData FieldSelectors where
rnf FieldSelectors = ()
rnf NoFieldSelectors = ()

instance NFData FieldLabel where
rnf (FieldLabel a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d
#endif
2 changes: 1 addition & 1 deletion haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ copyright: The Haskell IDE Team
license: Apache-2.0
license-file: LICENSE
build-type: Simple
tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8
tested-with: GHC == {9.12.2, 9.10.1, 9.8.4, 9.6.7}
extra-source-files:
README.md
ChangeLog.md
Expand Down
16 changes: 10 additions & 6 deletions hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}

module Ide.Plugin.ConfigUtils where
module Ide.Plugin.ConfigUtils (
pluginsToDefaultConfig,
pluginsToVSCodeExtensionSchema
) where

import Control.Lens (at, (&), (?~))
import qualified Data.Aeson as A
Expand Down Expand Up @@ -31,10 +34,10 @@ pluginsToDefaultConfig :: IdePlugins a -> A.Value
pluginsToDefaultConfig IdePlugins {..} =
-- Use '_Object' and 'at' to get at the "plugin" key
-- and actually set it.
A.toJSON defaultConfig & _Object . at "plugin" ?~ elems
A.toJSON defaultConfig & _Object . at "plugin" ?~ pluginSpecificDefaultConfigs
where
defaultConfig@Config {} = def
elems = A.object $ mconcat $ singlePlugin <$> ipMap
defaultConfig = def :: Config
pluginSpecificDefaultConfigs = A.object $ mconcat $ singlePlugin <$> ipMap
-- Splice genericDefaultConfig and dedicatedDefaultConfig
-- Example:
--
Expand All @@ -48,6 +51,7 @@ pluginsToDefaultConfig IdePlugins {..} =
-- }
-- }
-- }
singlePlugin :: PluginDescriptor ideState -> [A.Pair]
singlePlugin PluginDescriptor {pluginConfigDescriptor = ConfigDescriptor {..}, ..} =
let x = genericDefaultConfig <> dedicatedDefaultConfig
in [fromString (T.unpack pId) A..= A.object x | not $ null x]
Expand All @@ -66,8 +70,8 @@ pluginsToDefaultConfig IdePlugins {..} =
<> nubOrd (mconcat
(handlersToGenericDefaultConfig configInitialGenericConfig <$> handlers))
in case x of
-- if the plugin has only one capability, we produce globalOn instead of the specific one;
-- otherwise we don't produce globalOn at all
-- If the plugin has only one capability, we produce globalOn instead of the specific one;
-- otherwise we omit globalOn
[_] -> ["globalOn" A..= plcGlobalOn configInitialGenericConfig]
_ -> x
-- Example:
Expand Down
Loading