Skip to content

Commit fd7e6fa

Browse files
committed
review updates
1 parent 6100599 commit fd7e6fa

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

ocaml-lsp-server/docs/ocamllsp/typeSearch-spec.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface TypeSearchParams extends TexDocumentPositionParams
1717
query: string;
1818
limit: int;
1919
with_doc: bool;
20+
doc_format: string;
2021
}
2122
```
2223
- method: `ocamllsp/typeSearch`
@@ -36,7 +37,10 @@ export interface TypeSearchParams extends TexDocumentPositionParams
3637
"name": string,
3738
"typ": string,
3839
"loc": Range,
39-
"doc": string,
40+
"doc": {
41+
"value": string,
42+
"kind": string
43+
},
4044
"cost": int,
4145
"constructible" : string
4246
]

ocaml-lsp-server/src/custom_requests/req_type_search.ml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ module TypeSearchParams = struct
3737
| None -> []
3838
in
3939
`Assoc
40-
((("textDocument", TextDocumentIdentifier.yojson_of_t text_document)
41-
:: ("position", Position.yojson_of_t position)
42-
:: ("limit", `Int limit)
43-
:: ("with_doc", `Bool with_doc)
44-
:: [ "query", `String query ])
45-
@ doc_format)
40+
(("textDocument", TextDocumentIdentifier.yojson_of_t text_document)
41+
:: ("position", Position.yojson_of_t position)
42+
:: ("limit", `Int limit)
43+
:: ("with_doc", `Bool with_doc)
44+
:: ("query", `String query)
45+
:: doc_format)
4646
;;
4747
end
4848

4949
module TypeSearch = struct
5050
type t = string Query_protocol.type_search_result list
5151

52-
let create ~kind ~value =
52+
let doc_to_markupContent ~kind ~value =
5353
let v =
5454
match kind with
5555
| MarkupKind.Markdown ->
@@ -74,7 +74,8 @@ module TypeSearch = struct
7474
; "loc", Range.yojson_of_t (Range.of_loc res.loc)
7575
; ( "doc"
7676
, match res.doc with
77-
| Some value -> create ~kind:format ~value |> MarkupContent.yojson_of_t
77+
| Some value ->
78+
doc_to_markupContent ~kind:format ~value |> MarkupContent.yojson_of_t
7879
| None -> `Null )
7980
; "cost", `Int res.cost
8081
; "constructible", `String res.constructible

ocaml-lsp-server/test/e2e-new/type_search.ml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,7 @@ let%expect_test "Type Search for a simple query that takes an int and returns a
137137
let source = "" in
138138
let line = 1 in
139139
let character = 0 in
140-
Util.test
141-
~line
142-
~character
143-
~query:"int -> string"
144-
source
145-
~with_doc:false
146-
();
140+
Util.test ~line ~character ~query:"int -> string" source ~with_doc:false ();
147141
[%expect
148142
{|
149143
[

0 commit comments

Comments
 (0)