Skip to content

Commit a56cea9

Browse files
committed
Print to a string, not standard output.
1 parent d2e1540 commit a56cea9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

analysis/src/Actions.ml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,13 @@ let command ~path ~pos =
7676
let parser =
7777
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
7878
in
79-
let {Res_driver.parsetree = structure; comments; filename} =
80-
parser ~filename:path
81-
in
79+
let {Res_driver.parsetree = structure; comments} = parser ~filename:path in
8280
let printer =
83-
Res_driver.printEngine.printImplementation
84-
~width:!Res_cli.ResClflags.width ~comments ~filename
81+
Res_printer.printImplementation ~width:!Res_cli.ResClflags.width ~comments
8582
in
8683
let changed = ref false in
8784
let mapper = mkMapper ~pos ~changed in
8885
let newStructure = mapper.structure mapper structure in
89-
if !changed then printer newStructure
86+
if !changed then
87+
let formatted = printer newStructure in
88+
Printf.printf "Formatted:\n%s" formatted

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Actions tests/src/Actions.res 3:10
22
Hit _ifThenElse
3+
Formatted:
34
type kind = First | Second | Third
45

56
let _ = (kind, kindStr) => {
@@ -15,6 +16,7 @@ let _ = (kind, kindStr) => {
1516

1617
Actions tests/src/Actions.res 10:9
1718
Hit _ternary
19+
Formatted:
1820
type kind = First | Second | Third
1921

2022
let _ = (kind, kindStr) => {

0 commit comments

Comments
 (0)