File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ module Language.LSP.Test (
110110 -- ** Hover
111111 getHover ,
112112
113+ -- ** Signature Help
114+ getSignatureHelp ,
115+
113116 -- ** Highlights
114117 getHighlights ,
115118
@@ -933,6 +936,12 @@ getHover doc pos =
933936 let params = HoverParams doc pos Nothing
934937 in nullToMaybe . getResponseResult <$> request SMethod_TextDocumentHover params
935938
939+ -- | Returns the signature help at the specified position.
940+ getSignatureHelp :: TextDocumentIdentifier -> Position -> Maybe SignatureHelpContext -> Session (Maybe SignatureHelp )
941+ getSignatureHelp doc pos mCtx =
942+ let params = SignatureHelpParams doc pos Nothing mCtx
943+ in nullToMaybe . getResponseResult <$> request SMethod_TextDocumentSignatureHelp params
944+
936945-- | Returns the highlighted occurrences of the term at the specified position
937946getHighlights :: TextDocumentIdentifier -> Position -> Session [DocumentHighlight ]
938947getHighlights doc pos =
Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ handlers =
7272 Right $
7373 InL $
7474 Hover (InL (MarkupContent MarkupKind_PlainText " hello" )) Nothing
75+ , requestHandler SMethod_TextDocumentSignatureHelp $
76+ \ _req responder ->
77+ responder $
78+ Right $
79+ InL $
80+ SignatureHelp [] Nothing Nothing
7581 , requestHandler SMethod_TextDocumentDocumentSymbol $
7682 \ _req responder ->
7783 responder $
Original file line number Diff line number Diff line change @@ -307,6 +307,12 @@ main = hspec $ around withDummyServer $ do
307307 hover <- getHover doc (Position 45 9 )
308308 liftIO $ hover `shouldSatisfy` isJust
309309
310+ describe " getSignatureHelp" $
311+ it " works" $ \ (hin, hout) -> runSessionWithHandles hin hout def fullLatestClientCaps " ." $ do
312+ doc <- openDoc " test/data/renamePass/Desktop/simple.hs" " haskell"
313+ signatureHelp <- getSignatureHelp doc (Position 22 32 ) Nothing
314+ liftIO $ signatureHelp `shouldSatisfy` isJust
315+
310316 -- describe "getHighlights" $
311317 -- it "works" $ \(hin, hout) -> runSessionWithHandles hin hout def fullLatestClientCaps "." $ do
312318 -- doc <- openDoc "test/data/renamePass/Desktop/simple.hs" "haskell"
You can’t perform that action at this time.
0 commit comments