Skip to content

Commit 71b8d8d

Browse files
committed
WIP: no wired in Handlers
1 parent 99dc22e commit 71b8d8d

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

ghcide/src/Development/IDE/LSP/HoverDefinition.hs

+5-15
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55

66
-- | Display information on hover.
77
module Development.IDE.LSP.HoverDefinition
8-
( setIdeHandlers
8+
(
99
-- * For haskell-language-server
10-
, hover
10+
hover
1111
, gotoDefinition
1212
, gotoTypeDefinition
13+
, documentHighlight
14+
, references
15+
, wsSymbols
1316
) where
1417

1518
import Control.Monad.IO.Class
1619
import Development.IDE.Core.Actions
1720
import Development.IDE.Core.Rules
1821
import Development.IDE.Core.Shake
19-
import Development.IDE.LSP.Server
2022
import Development.IDE.Types.Location
2123
import Development.IDE.Types.Logger
2224
import qualified Language.LSP.Server as LSP
@@ -53,18 +55,6 @@ foundHover :: (Maybe Range, [T.Text]) -> Maybe Hover
5355
foundHover (mbRange, contents) =
5456
Just $ Hover (HoverContents $ MarkupContent MkMarkdown $ T.intercalate sectionSeparator contents) mbRange
5557

56-
setIdeHandlers :: LSP.Handlers (ServerM c)
57-
setIdeHandlers = mconcat
58-
[ requestHandler STextDocumentDefinition $ \ide DefinitionParams{..} ->
59-
gotoDefinition ide TextDocumentPositionParams{..}
60-
, requestHandler STextDocumentTypeDefinition $ \ide TypeDefinitionParams{..} ->
61-
gotoTypeDefinition ide TextDocumentPositionParams{..}
62-
, requestHandler STextDocumentDocumentHighlight $ \ide DocumentHighlightParams{..} ->
63-
documentHighlight ide TextDocumentPositionParams{..}
64-
, requestHandler STextDocumentReferences references
65-
, requestHandler SWorkspaceSymbol wsSymbols
66-
]
67-
6858
-- | Respond to and log a hover or go-to-definition request
6959
request
7060
:: T.Text

ghcide/src/Development/IDE/LSP/LanguageServer.hs

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import UnliftIO.Exception
3535
import Development.IDE.Core.IdeConfiguration
3636
import Development.IDE.Core.Shake hiding (Log)
3737
import Development.IDE.Core.Tracing
38-
import Development.IDE.LSP.HoverDefinition
3938
import Development.IDE.Types.Logger
4039

4140
import Control.Monad.IO.Unlift (MonadUnliftIO)
@@ -121,8 +120,7 @@ runLanguageServer recorder options inH outH getHieDbLoc defaultConfig onConfigur
121120
unless (reqId `Set.member` cancelled) retry
122121

123122
let ideHandlers = mconcat
124-
[ setIdeHandlers
125-
, userHandlers
123+
[ userHandlers
126124
]
127125

128126
-- Send everything over a channel, since you need to wait until after initialise before

ghcide/src/Development/IDE/Plugin/HLS/GhcIde.hs

+10-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ descriptors recorder =
4949
descriptor :: PluginId -> PluginDescriptor IdeState
5050
descriptor plId = (defaultPluginDescriptor plId)
5151
{ pluginHandlers = mkPluginHandler STextDocumentHover hover'
52-
<> mkPluginHandler STextDocumentDocumentSymbol symbolsProvider,
52+
<> mkPluginHandler STextDocumentDocumentSymbol symbolsProvider
53+
<> mkPluginHandler STextDocumentDefinition (\ide _ DefinitionParams{..} ->
54+
gotoDefinition ide TextDocumentPositionParams{..})
55+
<> mkPluginHandler STextDocumentTypeDefinition (\ide _ TypeDefinitionParams{..} ->
56+
gotoTypeDefinition ide TextDocumentPositionParams{..})
57+
<> mkPluginHandler STextDocumentDocumentHighlight (\ide _ DocumentHighlightParams{..} ->
58+
documentHighlight ide TextDocumentPositionParams{..})
59+
<> mkPluginHandler STextDocumentReferences (\ide _ params -> references ide params)
60+
<> mkPluginHandler SWorkspaceSymbol (\ide _ params -> wsSymbols ide params),
61+
5362
pluginConfigDescriptor = defaultConfigDescriptor {configEnableGenericConfig = False}
5463
}
5564

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

+16
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,22 @@ pluginResponsible uri pluginDesc
217217
where
218218
mfp = uriToFilePath uri
219219

220+
instance PluginMethod TextDocumentDefinition where
221+
pluginEnabled = undefined
222+
combineResponses = undefined
223+
instance PluginMethod TextDocumentTypeDefinition where
224+
pluginEnabled = undefined
225+
combineResponses = undefined
226+
instance PluginMethod TextDocumentDocumentHighlight where
227+
pluginEnabled = undefined
228+
combineResponses = undefined
229+
instance PluginMethod TextDocumentReferences where
230+
pluginEnabled = undefined
231+
combineResponses = undefined
232+
instance PluginMethod WorkspaceSymbol where
233+
pluginEnabled = undefined
234+
combineResponses = undefined
235+
220236
instance PluginMethod TextDocumentCodeLens where
221237
pluginEnabled _ msgParams pluginDesc config =
222238
pluginResponsible uri pluginDesc

0 commit comments

Comments
 (0)