Skip to content

Commit 005388a

Browse files
committed
Allow setting line width when printing types. Will use to nudge the printer towards printing function types for code lenses on one line
1 parent f508796 commit 005388a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

analysis/src/PrintType.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
let printExpr typ =
1+
let printExpr ?(lineWidth = 60) typ =
22
Printtyp.reset_names ();
3-
Res_doc.toString ~width:60
3+
Res_doc.toString ~width:lineWidth
44
(Res_outcome_printer.printOutTypeDoc (Printtyp.tree_of_typexp false typ))
55

66
let printDecl ~recStatus name decl =

analysis/src/Shared.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ let declToString ?(recStatus = Types.Trec_not) name t =
4949
let cacheTypeToString = ref false
5050
let typeTbl = Hashtbl.create 1
5151

52-
let typeToString (t : Types.type_expr) =
52+
let typeToString ?(lineWidth = 60) (t : Types.type_expr) =
5353
match
5454
if !cacheTypeToString then Hashtbl.find_opt typeTbl (t.id, t) else None
5555
with
5656
| None ->
57-
let s = PrintType.printExpr t in
57+
let s = PrintType.printExpr ~lineWidth t in
5858
Hashtbl.replace typeTbl (t.id, t) s;
5959
s
6060
| Some s -> s

0 commit comments

Comments
 (0)