Skip to content

Commit 7925321

Browse files
committed
chore: Simplify Function inlays
1 parent e94e17e commit 7925321

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

compiler/src/language_server/inlayhint.re

+11-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ let build_hint =
3838
{label: ": " ++ message, position};
3939
};
4040

41+
let rec string_of_typ = (typ: Types.type_expr) => {
42+
switch (typ.desc) {
43+
| TTyArrow(_, _, _) => "Function"
44+
| TTyLink(type_expr)
45+
| TTySubst(type_expr) => string_of_typ(type_expr)
46+
| _ => Printtyp.string_of_type_scheme(typ)
47+
};
48+
};
49+
4150
let find_hints = program => {
4251
let hints = ref([]);
4352
open Typedtree;
@@ -72,8 +81,8 @@ let find_hints = program => {
7281
line: bind_end.pos_lnum - 1,
7382
character: bind_end.pos_cnum - bind_end.pos_bol,
7483
};
75-
let typeSignature =
76-
Printtyp.string_of_type_scheme(vb_pat.pat_type);
84+
let typ = vb_pat.pat_type;
85+
let typeSignature = string_of_typ(typ);
7786
hints := [build_hint(p, typeSignature), ...hints^];
7887
| _ => ()
7988
}

0 commit comments

Comments
 (0)