Skip to content

Commit 50c7970

Browse files
committed
stylish-haskell parse errors solved (partially)
* Env: Changing order (import) * Plugins: Dangling `$`
1 parent 7d47a28 commit 50c7970

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

ghcide/src/Development/IDE/Core/Shake.hs

+4-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ import Development.IDE.GHC.Compat (NameCache,
130130
NameCacheUpdater (..),
131131
initNameCache,
132132
knownKeyNames,
133-
mkSplitUniqSupply,
134-
upNameCache)
133+
mkSplitUniqSupply)
134+
#if !MIN_VERSION_ghc(9,3,0)
135+
import Development.IDE.GHC.Compat (upNameCache)
136+
#endif
135137
import Development.IDE.GHC.Orphans ()
136138
import Development.IDE.Graph hiding (ShakeValue)
137139
import qualified Development.IDE.Graph as Shake

ghcide/src/Development/IDE/GHC/Compat/Env.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ import HscTypes as Env
9191
import Module
9292
#endif
9393

94-
#if MIN_VERSION_ghc(9,3,0)
95-
hsc_EPS :: HscEnv -> UnitEnv
96-
hsc_EPS = hsc_unit_env
97-
#endif
98-
9994
#if MIN_VERSION_ghc(9,0,0)
10095
#if !MIN_VERSION_ghc(9,2,0)
10196
import qualified Data.Set as Set
@@ -105,6 +100,11 @@ import qualified Data.Set as Set
105100
import Data.IORef
106101
#endif
107102

103+
#if MIN_VERSION_ghc(9,3,0)
104+
hsc_EPS :: HscEnv -> UnitEnv
105+
hsc_EPS = hsc_unit_env
106+
#endif
107+
108108
#if !MIN_VERSION_ghc(9,2,0)
109109
type UnitEnv = ()
110110
newtype Logger = Logger { log_action :: LogAction }

ghcide/src/Development/IDE/GHC/Compat/Plugins.hs

+6-7
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import qualified GHC.Driver.Env as Env
2424
import GHC.Driver.Plugins (Plugin (..),
2525
PluginWithArgs (..),
2626
StaticPlugin (..),
27+
defaultPlugin, withPlugins)
2728
#if MIN_VERSION_ghc(9,3,0)
28-
staticPlugins,
29-
ParsedResult(..),
30-
PsMessages(..),
29+
import GHC.Driver.Plugins (ParsedResult (..),
30+
PsMessages (..),
31+
staticPlugins)
3132
#endif
32-
defaultPlugin, withPlugins)
3333
import qualified GHC.Runtime.Loader as Loader
3434
#elif MIN_VERSION_ghc(8,8,0)
3535
import qualified DynamicLoading as Loader
@@ -48,11 +48,10 @@ applyPluginsParsedResultAction env dflags ms hpm_annotations parsed = do
4848
-- Apply parsedResultAction of plugins
4949
let applyPluginAction p opts = parsedResultAction p opts ms
5050
#if MIN_VERSION_ghc(9,3,0)
51-
fmap (hpm_module . parsedResultModule) $
51+
fmap (hpm_module . parsedResultModule) $ runHsc env $ withPlugins
5252
#else
53-
fmap hpm_module $
53+
fmap hpm_module $ runHsc env $ withPlugins
5454
#endif
55-
runHsc env $ withPlugins
5655
#if MIN_VERSION_ghc(9,3,0)
5756
(Env.hsc_plugins env)
5857
#elif MIN_VERSION_ghc(9,2,0)

ghcide/src/Development/IDE/Spans/Common.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ safeTyThingId (AConLike (RealDataCon dataCon)) = Just (dataConWrapId dataCon)
4949
safeTyThingId _ = Nothing
5050

5151
-- Possible documentation for an element in the code
52-
data SpanDoc
5352
#if MIN_VERSION_ghc(9,3,0)
53+
data SpanDoc
5454
= SpanDocString [HsDocString] SpanDocUris
5555
#else
56+
data SpanDoc
5657
= SpanDocString HsDocString SpanDocUris
5758
#endif
5859
| SpanDocText [T.Text] SpanDocUris

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/Util.hs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
module Development.IDE.Plugin.CodeAction.Util where
22

3-
#if MIN_VERSION_ghc(9,2,0)
4-
import GHC.Utils.Outputable
5-
#else
6-
import Development.IDE.GHC.Util
7-
import Development.IDE.GHC.Compat.Util
8-
import Development.IDE.GHC.Compat
9-
#endif
103
import Data.Data (Data)
114
import qualified Data.Unique as U
125
import Debug.Trace
@@ -18,6 +11,13 @@ import Text.Printf
1811
import Development.IDE.GHC.Dump (showAstDataHtml)
1912
import Data.Time.Clock.POSIX (POSIXTime, getCurrentTime,
2013
utcTimeToPOSIXSeconds)
14+
#if MIN_VERSION_ghc(9,2,0)
15+
import GHC.Utils.Outputable
16+
#else
17+
import Development.IDE.GHC.Util
18+
import Development.IDE.GHC.Compat.Util
19+
import Development.IDE.GHC.Compat
20+
#endif
2121
--------------------------------------------------------------------------------
2222
-- Tracing exactprint terms
2323

0 commit comments

Comments
 (0)