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 (
110
110
-- ** Hover
111
111
getHover ,
112
112
113
+ -- ** Signature Help
114
+ getSignatureHelp ,
115
+
113
116
-- ** Highlights
114
117
getHighlights ,
115
118
@@ -933,6 +936,12 @@ getHover doc pos =
933
936
let params = HoverParams doc pos Nothing
934
937
in nullToMaybe . getResponseResult <$> request SMethod_TextDocumentHover params
935
938
939
+ -- | Returns the signature help at the specified position.
940
+ getSignatureHelp :: TextDocumentIdentifier -> Position -> Session (Maybe SignatureHelp )
941
+ getSignatureHelp doc pos =
942
+ let params = SignatureHelpParams doc pos Nothing Nothing
943
+ in nullToMaybe . getResponseResult <$> request SMethod_TextDocumentSignatureHelp params
944
+
936
945
-- | Returns the highlighted occurrences of the term at the specified position
937
946
getHighlights :: TextDocumentIdentifier -> Position -> Session [DocumentHighlight ]
938
947
getHighlights doc pos =
Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ handlers =
72
72
Right $
73
73
InL $
74
74
Hover (InL (MarkupContent MarkupKind_PlainText " hello" )) Nothing
75
+ , requestHandler SMethod_TextDocumentSignatureHelp $
76
+ \ _req responder ->
77
+ responder $
78
+ Right $
79
+ InL $
80
+ SignatureHelp [] Nothing Nothing
75
81
, requestHandler SMethod_TextDocumentDocumentSymbol $
76
82
\ _req responder ->
77
83
responder $
Original file line number Diff line number Diff line change @@ -307,6 +307,12 @@ main = hspec $ around withDummyServer $ do
307
307
hover <- getHover doc (Position 45 9 )
308
308
liftIO $ hover `shouldSatisfy` isJust
309
309
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 )
314
+ liftIO $ signatureHelp `shouldSatisfy` isJust
315
+
310
316
-- describe "getHighlights" $
311
317
-- it "works" $ \(hin, hout) -> runSessionWithHandles hin hout def fullLatestClientCaps "." $ do
312
318
-- doc <- openDoc "test/data/renamePass/Desktop/simple.hs" "haskell"
You can’t perform that action at this time.
0 commit comments