Skip to content

Commit

Permalink
stylish-haskell parse errors solved (partially)
Browse files Browse the repository at this point in the history
* Env: Changing order (import)
* Plugins: Dangling `$`
  • Loading branch information
andys8 committed Sep 15, 2022
1 parent 357c681 commit e134351
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
6 changes: 4 additions & 2 deletions ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ import Development.IDE.GHC.Compat (NameCache,
NameCacheUpdater (..),
initNameCache,
knownKeyNames,
mkSplitUniqSupply,
upNameCache)
mkSplitUniqSupply)
#if !MIN_VERSION_ghc(9,3,0)
import Development.IDE.GHC.Compat (upNameCache)
#endif
import Development.IDE.GHC.Orphans ()
import Development.IDE.Graph hiding (ShakeValue)
import qualified Development.IDE.Graph as Shake
Expand Down
10 changes: 5 additions & 5 deletions ghcide/src/Development/IDE/GHC/Compat/Env.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ import HscTypes as Env
import Module
#endif

#if MIN_VERSION_ghc(9,3,0)
hsc_EPS :: HscEnv -> UnitEnv
hsc_EPS = hsc_unit_env
#endif

#if MIN_VERSION_ghc(9,0,0)
#if !MIN_VERSION_ghc(9,2,0)
import qualified Data.Set as Set
Expand All @@ -105,6 +100,11 @@ import qualified Data.Set as Set
import Data.IORef
#endif

#if MIN_VERSION_ghc(9,3,0)
hsc_EPS :: HscEnv -> UnitEnv
hsc_EPS = hsc_unit_env
#endif

#if !MIN_VERSION_ghc(9,2,0)
type UnitEnv = ()
newtype Logger = Logger { log_action :: LogAction }
Expand Down
13 changes: 6 additions & 7 deletions ghcide/src/Development/IDE/GHC/Compat/Plugins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import qualified GHC.Driver.Env as Env
import GHC.Driver.Plugins (Plugin (..),
PluginWithArgs (..),
StaticPlugin (..),
defaultPlugin, withPlugins)
#if MIN_VERSION_ghc(9,3,0)
staticPlugins,
ParsedResult(..),
PsMessages(..),
import GHC.Driver.Plugins (ParsedResult (..),
PsMessages (..),
staticPlugins)
#endif
defaultPlugin, withPlugins)
import qualified GHC.Runtime.Loader as Loader
#elif MIN_VERSION_ghc(8,8,0)
import qualified DynamicLoading as Loader
Expand All @@ -48,11 +48,10 @@ applyPluginsParsedResultAction env dflags ms hpm_annotations parsed = do
-- Apply parsedResultAction of plugins
let applyPluginAction p opts = parsedResultAction p opts ms
#if MIN_VERSION_ghc(9,3,0)
fmap (hpm_module . parsedResultModule) $
fmap (hpm_module . parsedResultModule) $ runHsc env $ withPlugins
#else
fmap hpm_module $
fmap hpm_module $ runHsc env $ withPlugins
#endif
runHsc env $ withPlugins
#if MIN_VERSION_ghc(9,3,0)
(Env.hsc_plugins env)
#elif MIN_VERSION_ghc(9,2,0)
Expand Down
3 changes: 2 additions & 1 deletion ghcide/src/Development/IDE/Spans/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ safeTyThingId (AConLike (RealDataCon dataCon)) = Just (dataConWrapId dataCon)
safeTyThingId _ = Nothing

-- Possible documentation for an element in the code
data SpanDoc
#if MIN_VERSION_ghc(9,3,0)
data SpanDoc
= SpanDocString [HsDocString] SpanDocUris
#else
data SpanDoc
= SpanDocString HsDocString SpanDocUris
#endif
| SpanDocText [T.Text] SpanDocUris
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
module Development.IDE.Plugin.CodeAction.Util where

#if MIN_VERSION_ghc(9,2,0)
import GHC.Utils.Outputable
#else
import Development.IDE.GHC.Util
import Development.IDE.GHC.Compat.Util
import Development.IDE.GHC.Compat
#endif
import Data.Data (Data)
import qualified Data.Unique as U
import Debug.Trace
Expand All @@ -18,6 +11,13 @@ import Text.Printf
import Development.IDE.GHC.Dump (showAstDataHtml)
import Data.Time.Clock.POSIX (POSIXTime, getCurrentTime,
utcTimeToPOSIXSeconds)
#if MIN_VERSION_ghc(9,2,0)
import GHC.Utils.Outputable
#else
import Development.IDE.GHC.Util
import Development.IDE.GHC.Compat.Util
import Development.IDE.GHC.Compat
#endif
--------------------------------------------------------------------------------
-- Tracing exactprint terms

Expand Down

0 comments on commit e134351

Please sign in to comment.