Skip to content

Commit 324058c

Browse files
committed
small docs for React.element methods
1 parent a852d22 commit 324058c

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,9 +1515,15 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
15151515
when checkName builtinNameToComplete ~prefix:funNamePrefix
15161516
~exact:false ->
15171517
[
1518-
Completion.create
1518+
Completion.createWithSnippet
15191519
~name:("React." ^ builtinNameToComplete)
1520-
~kind:(Value typ) ~env;
1520+
~kind:(Value typ) ~env
1521+
~docstring:
1522+
[
1523+
"Turns `" ^ builtinNameToComplete
1524+
^ "` into `React.element` so it can be used inside of JSX.";
1525+
]
1526+
();
15211527
]
15221528
@ completions
15231529
| _ -> completions)

analysis/src/SharedTypes.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,13 @@ module Completion = struct
316316
insertTextFormat = None;
317317
}
318318

319-
let createWithSnippet ~name ?insertText ~kind ~env ?sortText () =
319+
let createWithSnippet ~name ?insertText ~kind ~env ?sortText ?(docstring = [])
320+
() =
320321
{
321322
name;
322323
env;
323324
deprecated = None;
324-
docstring = [];
325+
docstring;
325326
kind;
326327
sortText;
327328
insertText;

analysis/tests/src/expected/CompletionJsx.res.txt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Completable: Cpath Value[someString]->st <<jsx>>
2929
"kind": 12,
3030
"tags": [],
3131
"detail": "string",
32-
"documentation": null
32+
"documentation": {"kind": "markdown", "value": "Turns `string` into `React.element` so it can be used inside of JSX."},
33+
"insertTextFormat": 2
3334
}, {
3435
"label": "Js.String2.startsWith",
3536
"kind": 12,
@@ -68,7 +69,8 @@ Completable: Cpath Value[someString]->st <<jsx>>
6869
"kind": 12,
6970
"tags": [],
7071
"detail": "string",
71-
"documentation": null
72+
"documentation": {"kind": "markdown", "value": "Turns `string` into `React.element` so it can be used inside of JSX."},
73+
"insertTextFormat": 2
7274
}, {
7375
"label": "Js.String2.startsWith",
7476
"kind": 12,
@@ -107,7 +109,8 @@ Completable: Cpath string->st <<jsx>>
107109
"kind": 12,
108110
"tags": [],
109111
"detail": "string",
110-
"documentation": null
112+
"documentation": {"kind": "markdown", "value": "Turns `string` into `React.element` so it can be used inside of JSX."},
113+
"insertTextFormat": 2
111114
}, {
112115
"label": "Js.String2.startsWith",
113116
"kind": 12,
@@ -146,7 +149,8 @@ Completable: Cpath Value[Js, String2, trim](Nolabel)->st <<jsx>>
146149
"kind": 12,
147150
"tags": [],
148151
"detail": "string",
149-
"documentation": null
152+
"documentation": {"kind": "markdown", "value": "Turns `string` into `React.element` so it can be used inside of JSX."},
153+
"insertTextFormat": 2
150154
}, {
151155
"label": "Js.String2.startsWith",
152156
"kind": 12,
@@ -185,7 +189,8 @@ Completable: Cpath Value[someInt]-> <<jsx>>
185189
"kind": 12,
186190
"tags": [],
187191
"detail": "int",
188-
"documentation": null
192+
"documentation": {"kind": "markdown", "value": "Turns `int` into `React.element` so it can be used inside of JSX."},
193+
"insertTextFormat": 2
189194
}, {
190195
"label": "Belt.Int.fromString",
191196
"kind": 12,
@@ -260,7 +265,8 @@ Completable: Cpath int-> <<jsx>>
260265
"kind": 12,
261266
"tags": [],
262267
"detail": "int",
263-
"documentation": null
268+
"documentation": {"kind": "markdown", "value": "Turns `int` into `React.element` so it can be used inside of JSX."},
269+
"insertTextFormat": 2
264270
}, {
265271
"label": "Belt.Int.fromString",
266272
"kind": 12,
@@ -335,7 +341,8 @@ Completable: Cpath Value[someArr]->a <<jsx>>
335341
"kind": 12,
336342
"tags": [],
337343
"detail": "array<React.element>",
338-
"documentation": null
344+
"documentation": {"kind": "markdown", "value": "Turns `array` into `React.element` so it can be used inside of JSX."},
345+
"insertTextFormat": 2
339346
}, {
340347
"label": "Js.Array2.append",
341348
"kind": 12,

0 commit comments

Comments
 (0)