Skip to content

Commit 8e13c6a

Browse files
committed
More generic test printing of code actions.
1 parent bfab2ad commit 8e13c6a

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

analysis/src/Commands.ml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -364,17 +364,15 @@ let test ~path =
364364
Xform.extractCodeActions ~path ~pos:(line, col) ~currentFile:path
365365
in
366366
codeActions
367-
|> List.iter (fun codeAction ->
368-
match codeAction with
369-
| {
370-
Protocol.title;
371-
edit = {documentChanges = [{edits = [{range; newText}]}]};
372-
} ->
373-
Printf.printf "Hit %s %s\nnewText:\n%s\n" title
374-
(Protocol.stringifyRange range)
375-
newText
376-
| _ -> assert false
377-
(* TODO *))
367+
|> List.iter (fun {Protocol.title; edit = {documentChanges}} ->
368+
Printf.printf "Hit: %s\n" title;
369+
documentChanges
370+
|> List.iter (fun {Protocol.edits} ->
371+
edits
372+
|> List.iter (fun {Protocol.range; newText} ->
373+
Printf.printf "%s\nnewText:\n%s\n"
374+
(Protocol.stringifyRange range)
375+
newText)))
378376
| _ -> ());
379377
print_newline ())
380378
in

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Xform tests/src/Xform.res 6:5
2-
Hit Replace with switch {"start": {"line": 6, "character": 0}, "end": {"line": 11, "character": 1}}
2+
Hit: Replace with switch
3+
{"start": {"line": 6, "character": 0}, "end": {"line": 11, "character": 1}}
34
newText:
45
switch kind {
56
| First =>
@@ -9,7 +10,8 @@ switch kind {
910
}
1011

1112
Xform tests/src/Xform.res 13:15
12-
Hit Replace with switch {"start": {"line": 13, "character": 0}, "end": {"line": 13, "character": 79}}
13+
Hit: Replace with switch
14+
{"start": {"line": 13, "character": 0}, "end": {"line": 13, "character": 79}}
1315
newText:
1416
switch kind {
1517
| #kind("First", {name: "abc", age: 3}) => ret("First")

0 commit comments

Comments
 (0)