Add getHover
[opengl.git] / src / Language / Haskell / LSP / Test.hs
index d4c63110890707bcbb40a2457ffb2ac68b844590..403c0e112600acda919a77656434e8a792f089d8 100644 (file)
@@ -69,6 +69,8 @@ module Language.Haskell.LSP.Test
   , getDefinitions
   -- ** Renaming
   , rename
+  -- ** Hover
+  , getHover
   -- ** Edits
   , applyEdit
   ) where
@@ -459,6 +461,12 @@ rename doc pos newName = do
       req = RequestMessage "" (IdInt 0) WorkspaceApplyEdit (ApplyWorkspaceEditParams wEdit)
   updateState (ReqApplyWorkspaceEdit req)
 
+-- ^ Returns the hover information at the specified position.
+getHover :: TextDocumentIdentifier -> Position -> Session (Maybe Hover)
+getHover doc pos = do
+  let params = TextDocumentPositionParams doc pos
+  getResponseResult <$> sendRequest TextDocumentHover params
+
 -- | Checks the response for errors and throws an exception if needed.
 -- Returns the result if successful.
 getResponseResult :: ResponseMessage a -> a