@@ -2,11 +2,11 @@ open Test.Import
22module Req = Ocaml_lsp_server.Custom_request. Type_search
33
44module Util = struct
5- let call_search position query with_doc client =
5+ let call_search position query with_doc doc_format client =
66 let uri = DocumentUri. of_path " test.ml" in
77 let text_document = TextDocumentIdentifier. create ~uri in
88 let params =
9- Req.Request_params. create text_document position 3 query with_doc
9+ Req.Request_params. create text_document position 3 query with_doc doc_format
1010 |> Req.Request_params. yojson_of_t
1111 |> Jsonrpc.Structured. t_of_yojson
1212 |> Option. some
@@ -17,11 +17,11 @@ module Util = struct
1717 Client. request client req
1818 ;;
1919
20- let test ~line ~character ~query source ~with_doc =
20+ let test ~line ~character ~query source ~with_doc ?( doc_format = None ) () =
2121 let position = Position. create ~character ~line in
2222 let request client =
2323 let open Fiber.O in
24- let + response = call_search position query with_doc client in
24+ let + response = call_search position query with_doc doc_format client in
2525 Test. print_result response
2626 in
2727 Helpers. test source request
@@ -34,7 +34,8 @@ let%expect_test "Polarity Search for a simple query that takes an int and return
3434 let source = " " in
3535 let line = 1 in
3636 let character = 0 in
37- Util. test ~line ~character ~query: " -int +string" source ~with_doc: true ;
37+ let doc_format = Some MarkupKind. Markdown in
38+ Util. test ~line ~character ~query: " -int +string" source ~with_doc: true ~doc_format () ;
3839 [% expect
3940 {|
4041 [
@@ -45,7 +46,10 @@ let%expect_test "Polarity Search for a simple query that takes an int and return
4546 " end" : { " character" : 29 , " line" : 152 },
4647 " start" : { " character" : 0 , " line" : 152 }
4748 },
48- " doc" : " [to_string x] is the written representation of [x] in decimal." ,
49+ " doc" : {
50+ " kind" : " markdown" ,
51+ " value" : " `to_string x` is the written representation of `x` in decimal."
52+ },
4953 " cost" : 4 ,
5054 " constructible" : " Int.to_string _"
5155 },
@@ -56,7 +60,10 @@ let%expect_test "Polarity Search for a simple query that takes an int and return
5660 " end" : { " character" : 33 , " line" : 740 },
5761 " start" : { " character" : 0 , " line" : 740 }
5862 },
59- " doc" : " Return the string representation of an integer, in decimal." ,
63+ " doc" : {
64+ " kind" : " markdown" ,
65+ " value" : " Return the string representation of an integer, in decimal."
66+ },
6067 " cost" : 4 ,
6168 " constructible" : " string_of_int _"
6269 },
@@ -67,11 +74,15 @@ let%expect_test "Polarity Search for a simple query that takes an int and return
6774 " end" : { " character" : 33 , " line" : 740 },
6875 " start" : { " character" : 0 , " line" : 740 }
6976 },
70- " doc" : " Return the string representation of an integer, in decimal." ,
77+ " doc" : {
78+ " kind" : " markdown" ,
79+ " value" : " Return the string representation of an integer, in decimal."
80+ },
7181 " cost" : 4 ,
7282 " constructible" : " string_of_int _"
7383 }
74- ] | }]
84+ ]
85+ | }]
7586;;
7687
7788let % expect_test " Polarity Search for a simple query that takes an int and returns a \
@@ -80,7 +91,7 @@ let%expect_test "Polarity Search for a simple query that takes an int and return
8091 let source = " " in
8192 let line = 1 in
8293 let character = 0 in
83- Util. test ~line ~character ~query: " -int +string" source ~with_doc: false ;
94+ Util. test ~line ~character ~query: " -int +string" source ~with_doc: false () ;
8495 [% expect
8596 {|
8697 [
@@ -126,7 +137,13 @@ let%expect_test "Type Search for a simple query that takes an int and returns a
126137 let source = " " in
127138 let line = 1 in
128139 let character = 0 in
129- Util. test ~line ~character ~query: " int -> string" source ~with_doc: false ;
140+ Util. test
141+ ~line
142+ ~character
143+ ~query: " int -> string"
144+ source
145+ ~with_doc: false
146+ () ;
130147 [% expect
131148 {|
132149 [
@@ -172,7 +189,7 @@ let%expect_test "Type Search for a simple query that takes an int and returns a
172189 let source = " " in
173190 let line = 1 in
174191 let character = 0 in
175- Util. test ~line ~character ~query: " int -> string" source ~with_doc: true ;
192+ Util. test ~line ~character ~query: " int -> string" source ~with_doc: true () ;
176193 [% expect
177194 {|
178195 [
@@ -183,7 +200,10 @@ let%expect_test "Type Search for a simple query that takes an int and returns a
183200 " end" : { " character" : 29 , " line" : 152 },
184201 " start" : { " character" : 0 , " line" : 152 }
185202 },
186- " doc" : " [to_string x] is the written representation of [x] in decimal." ,
203+ " doc" : {
204+ " kind" : " plaintext" ,
205+ " value" : " [to_string x] is the written representation of [x] in decimal."
206+ },
187207 " cost" : 0 ,
188208 " constructible" : " Int.to_string _"
189209 },
@@ -194,7 +214,10 @@ let%expect_test "Type Search for a simple query that takes an int and returns a
194214 " end" : { " character" : 33 , " line" : 740 },
195215 " start" : { " character" : 0 , " line" : 740 }
196216 },
197- " doc" : " Return the string representation of an integer, in decimal." ,
217+ " doc" : {
218+ " kind" : " plaintext" ,
219+ " value" : " Return the string representation of an integer, in decimal."
220+ },
198221 " cost" : 0 ,
199222 " constructible" : " string_of_int _"
200223 },
@@ -205,9 +228,13 @@ let%expect_test "Type Search for a simple query that takes an int and returns a
205228 " end" : { " character" : 33 , " line" : 740 },
206229 " start" : { " character" : 0 , " line" : 740 }
207230 },
208- " doc" : " Return the string representation of an integer, in decimal." ,
231+ " doc" : {
232+ " kind" : " plaintext" ,
233+ " value" : " Return the string representation of an integer, in decimal."
234+ },
209235 " cost" : 0 ,
210236 " constructible" : " string_of_int _"
211237 }
212- ] | }]
238+ ]
239+ | }]
213240;;
0 commit comments