@@ -33,6 +33,11 @@ let send_no_result = (~id: Protocol.message_id) => {
33
33
Protocol . response(~id, ` Null );
34
34
};
35
35
36
+ let build_hint =
37
+ (position: Protocol . position , message: string ): ResponseResult . inlay_hint => {
38
+ {label: ": " ++ message, position};
39
+ };
40
+
36
41
let find_hints = program => {
37
42
let hints = ref ([] );
38
43
open Typedtree ;
@@ -52,12 +57,26 @@ let find_hints = program => {
52
57
line: stmt_end. pos_lnum - 1 ,
53
58
character: stmt_end. pos_cnum - stmt_end. pos_bol + 1 + 1 ,
54
59
};
60
+ hints := [ build_hint(p, name), ... hints^ ] ;
61
+ | _ => ()
62
+ };
63
+ };
55
64
56
- let r : ResponseResult . inlay_hint = {
57
- label: ": " ++ name,
58
- position: p,
59
- };
60
- hints := [ r, ... hints^ ] ;
65
+ let enter_binding = ({vb_pat}: value_binding ) => {
66
+ switch (vb_pat. pat_extra) {
67
+ | [] =>
68
+ switch (vb_pat. pat_desc) {
69
+ | TPatVar (_ , {loc}) =>
70
+ let bind_end = loc. loc_end;
71
+ let p : Protocol . position = {
72
+ line: bind_end. pos_lnum - 1 ,
73
+ character: bind_end. pos_cnum - bind_end. pos_bol,
74
+ };
75
+ let typeSignature =
76
+ Printtyp . string_of_type_scheme(vb_pat. pat_type);
77
+ hints := [ build_hint(p, typeSignature), ... hints^ ] ;
78
+ | _ => ()
79
+ }
61
80
| _ => ()
62
81
};
63
82
};
0 commit comments