File tree 5 files changed +18
-3
lines changed 5 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -598,7 +598,7 @@ let completionsForExportedConstructors ~(env : QueryEnv.t) ~prefix ~exact
598
598
if not (Hashtbl. mem namesUsed name) then
599
599
let () = Hashtbl. add namesUsed name () in
600
600
Some
601
- (Completion. create ~name ~env
601
+ (Completion. create ~name ~env ~docstring: c.docstring
602
602
~kind:
603
603
(Completion. Constructor
604
604
(c, t.item.decl |> Shared. declToString t.name.txt))
Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ let newHover ~full:{file; package} ~supportsMarkdownLinks locItem =
241
241
| `Declared ->
242
242
let typeString, docstring = t |> fromType ~docstring in
243
243
typeString :: docstring
244
- | `Constructor {cname = {txt} ; args} ->
244
+ | `Constructor {cname = {txt} ; args; docstring } ->
245
245
let typeString, docstring = t |> fromType ~docstring in
246
246
let argsString =
247
247
match args with
Original file line number Diff line number Diff line change @@ -76,6 +76,13 @@ let rec forTypeSignatureItem ~(env : SharedTypes.Env.t) ~(exported : Exported.t)
76
76
| Cstr_record _ -> [] );
77
77
res = cd_res;
78
78
typeDecl = (name, decl);
79
+ docstring =
80
+ (match
81
+ ProcessAttributes. findDocAttribute
82
+ cd_attributes
83
+ with
84
+ | None -> []
85
+ | Some docstring -> [docstring]);
79
86
}
80
87
in
81
88
let declared =
@@ -207,6 +214,12 @@ let forTypeDeclaration ~env ~(exported : Exported.t)
207
214
| None -> None
208
215
| Some t -> Some t.ctyp_type);
209
216
typeDecl = (name.txt, typ_type);
217
+ docstring =
218
+ (match
219
+ ProcessAttributes. findDocAttribute cd_attributes
220
+ with
221
+ | None -> []
222
+ | Some docstring -> [docstring]);
210
223
}
211
224
in
212
225
let declared =
Original file line number Diff line number Diff line change @@ -169,7 +169,8 @@ let definedForLoc ~file ~package locKind =
169
169
| Constructor name -> (
170
170
match getConstructor file stamp name with
171
171
| None -> None
172
- | Some constructor -> Some ([] , `Constructor constructor))
172
+ | Some constructor ->
173
+ Some (constructor.docstring, `Constructor constructor))
173
174
| Field name ->
174
175
Some
175
176
( (match getField file stamp name with
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ module Constructor = struct
39
39
args : (Types .type_expr * Location .t ) list ;
40
40
res : Types .type_expr option ;
41
41
typeDecl : string * Types .type_declaration ;
42
+ docstring : string list ;
42
43
}
43
44
end
44
45
You can’t perform that action at this time.
0 commit comments