Skip to content

Commit 7b652bd

Browse files
committed
Invert the dependency between hls-plugin-api and ghcide
1 parent 38151a0 commit 7b652bd

File tree

26 files changed

+286
-978
lines changed

26 files changed

+286
-978
lines changed

exe/Plugins.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
module Plugins where
44

55
import Ide.Types (IdePlugins)
6-
import Ide.Plugin (pluginDescToIdePlugins)
6+
import Ide.PluginUtils (pluginDescToIdePlugins)
77

88
-- fixed plugins
99
import Ide.Plugin.Example as Example
1010
import Ide.Plugin.Example2 as Example2
11-
import Ide.Plugin.GhcIde as GhcIde
11+
import Development.IDE (IdeState)
12+
import Development.IDE.Plugin.GhcIde as GhcIde
1213

1314
-- haskell-language-server optional plugins
1415

@@ -73,7 +74,7 @@ import Ide.Plugin.Brittany as Brittany
7374
-- These can be freely added or removed to tailor the available
7475
-- features of the server.
7576

76-
idePlugins :: Bool -> IdePlugins
77+
idePlugins :: Bool -> IdePlugins IdeState
7778
idePlugins includeExamples = pluginDescToIdePlugins allPlugins
7879
where
7980
allPlugins = if includeExamples

hls-plugin-api/hls-plugin-api.cabal

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ source-repository head
2626
library
2727
exposed-modules:
2828
Ide.Logger
29-
Ide.Plugin
3029
Ide.Plugin.Config
31-
Ide.Plugin.Formatter
32-
Ide.Plugin.GhcIde
3330
Ide.PluginUtils
3431
Ide.Types
3532

@@ -40,9 +37,6 @@ library
4037
, containers
4138
, data-default
4239
, Diff
43-
, ghc
44-
, ghc-boot-th
45-
, ghcide >=0.5
4640
, haskell-lsp ^>=0.22
4741
, hashable
4842
, hslogger
@@ -53,6 +47,13 @@ library
5347
, text
5448
, unordered-containers
5549

50+
if os(windows)
51+
build-depends:
52+
Win32
53+
else
54+
build-depends:
55+
unix
56+
5657
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing
5758

5859
if flag(pedantic)

hls-plugin-api/src/Ide/Logger.hs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,17 @@
33
-}
44
module Ide.Logger
55
(
6-
hlsLogger
7-
, logm
6+
logm
87
, debugm
98
, warningm
109
, errorm
1110
) where
1211

1312
import Control.Monad.IO.Class
14-
import qualified Data.Text as T
15-
import qualified Development.IDE.Types.Logger as L
1613
import System.Log.Logger
1714

1815
-- ---------------------------------------------------------------------
1916

20-
hlsLogger :: L.Logger
21-
hlsLogger = L.Logger $ \pri txt ->
22-
case pri of
23-
L.Telemetry -> logm (T.unpack txt)
24-
L.Debug -> debugm (T.unpack txt)
25-
L.Info -> logm (T.unpack txt)
26-
L.Warning -> warningm (T.unpack txt)
27-
L.Error -> errorm (T.unpack txt)
28-
29-
-- ---------------------------------------------------------------------
30-
3117
logm :: MonadIO m => String -> m ()
3218
logm s = liftIO $ infoM "hls" s
3319

0 commit comments

Comments
 (0)