Skip to content

Commit b8f2241

Browse files
committed
Create plugin for wrapping the handlers from ghcide
The way PartialHandlers are chained in ghcide means earlier ones get masked by ones added later in the chain. Create GhcIde plugin so the underlying hover handler can be combined with other configured hover handlers at the haskell-language-server combined handler. Requires haskell/ghcide#490
1 parent 17b150b commit b8f2241

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
# rm -rf path_to_submodule
1111
[submodule "ghcide"]
1212
path = ghcide
13-
url = https://github.com/digital-asset/ghcide.git
14-
# url = https://github.com/alanz/ghcide.git
13+
# url = https://github.com/digital-asset/ghcide.git
14+
url = https://github.com/alanz/ghcide.git

exe/Main.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,20 @@ import System.Log.Logger as L
5858
import System.Time.Extra
5959

6060
-- ---------------------------------------------------------------------
61-
61+
-- ghcide partialhandlers
6262
import Development.IDE.Plugin.CodeAction as CodeAction
6363
import Development.IDE.Plugin.Completions as Completions
64+
import Development.IDE.LSP.HoverDefinition as HoverDefinition
65+
66+
-- haskell-language-server plugins
6467
import Ide.Plugin.Example as Example
6568
import Ide.Plugin.Example2 as Example2
69+
import Ide.Plugin.GhcIde as GhcIde
6670
import Ide.Plugin.Floskell as Floskell
6771
import Ide.Plugin.Ormolu as Ormolu
6872
import Ide.Plugin.Pragmas as Pragmas
6973

74+
7075
-- ---------------------------------------------------------------------
7176

7277
-- | The plugins configured for use in this instance of the language
@@ -90,7 +95,8 @@ idePlugins pid includeExamples
9095
-- , hsimportDescriptor "hsimport"
9196
-- , liquidDescriptor "liquid"
9297
-- , packageDescriptor "package"
93-
Pragmas.descriptor "pragmas"
98+
GhcIde.descriptor "ghc"
99+
, Pragmas.descriptor "pragmas"
94100
, Floskell.descriptor "floskell"
95101
-- , genericDescriptor "generic"
96102
-- , ghcmodDescriptor "ghcmod"
@@ -145,6 +151,7 @@ main = do
145151
-- (ps, commandIds) = idePlugins pid argsExamplePlugin
146152
(ps, commandIds) = idePlugins pid True
147153
plugins = Completions.plugin <> CodeAction.plugin <>
154+
Plugin mempty HoverDefinition.setHandlersDefinition <>
148155
ps
149156
options = def { LSP.executeCommandCommands = Just commandIds
150157
, LSP.completionTriggerCharacters = Just "."

haskell-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ library
3434
Ide.Plugin.Config
3535
Ide.Plugin.Example
3636
Ide.Plugin.Example2
37+
Ide.Plugin.GhcIde
3738
Ide.Plugin.Ormolu
3839
Ide.Plugin.Pragmas
3940
Ide.Plugin.Floskell

src/Ide/Plugin.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Ide.Plugin.Config
4040
import Ide.Plugin.Formatter
4141
import Ide.Types
4242
import qualified Language.Haskell.LSP.Core as LSP
43+
import qualified Language.Haskell.LSP.Messages as LSP
4344
import Language.Haskell.LSP.Messages
4445
import Language.Haskell.LSP.Types
4546
import qualified Language.Haskell.LSP.Types as J

0 commit comments

Comments
 (0)