Skip to content

Commit e95c809

Browse files
committed
Use deb+ and deb+ command to turn debug on/off.
Separates debug from the actual command (which currently was go to def).
1 parent 3aef372 commit e95c809

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

analysis/src/Commands.ml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,8 @@ let test ~path =
296296
let col = mlen - 1 in
297297
if mlen >= 3 then (
298298
(match String.sub rest 0 3 with
299-
| "deb" ->
300-
Log.verbose := true;
301-
print_endline
302-
("Debug " ^ path ^ " " ^ string_of_int line ^ ":"
303-
^ string_of_int col);
304-
let res = definition ~path ~line ~col in
305-
Log.verbose := false;
306-
res
299+
| "db+" -> Log.verbose := true
300+
| "db-" -> Log.verbose := false
307301
| "def" ->
308302
print_endline
309303
("Definition " ^ path ^ " " ^ string_of_int line ^ ":"

analysis/tests/src/Debug.res

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
// ^db+
12
let _ = Belt.List.map
2-
// ^deb
3+
// ^def
34

45
let _ = List.map
5-
// ^deb
6+
// ^def
7+
// ^db-

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Debug tests/src/Debug.res 0:20
1+
2+
Definition tests/src/Debug.res 1:20
23
Dependencies: @rescript/react
34
Source directories: tests/node_modules/@rescript/react/./src tests/node_modules/@rescript/react/./src/legacy
45
Source files: tests/node_modules/@rescript/react/./src/React.res tests/node_modules/@rescript/react/./src/ReactDOM.res tests/node_modules/@rescript/react/./src/ReactDOMServer.res tests/node_modules/@rescript/react/./src/ReactDOMStyle.res tests/node_modules/@rescript/react/./src/ReactEvent.res tests/node_modules/@rescript/react/./src/ReactEvent.resi tests/node_modules/@rescript/react/./src/ReactTestUtils.res tests/node_modules/@rescript/react/./src/ReactTestUtils.resi tests/node_modules/@rescript/react/./src/RescriptReactErrorBoundary.res tests/node_modules/@rescript/react/./src/RescriptReactErrorBoundary.resi tests/node_modules/@rescript/react/./src/RescriptReactRouter.res tests/node_modules/@rescript/react/./src/RescriptReactRouter.resi tests/node_modules/@rescript/react/./src/legacy/ReactDOMRe.res tests/node_modules/@rescript/react/./src/legacy/ReasonReact.res
@@ -27,7 +28,7 @@ Impl cmt:tests/lib/bs/./src/TypeDefinition.cmt res:tests/src/TypeDefinition.res
2728
Dependency dirs: tests/node_modules/@rescript/react/lib/bs/./src tests/node_modules/@rescript/react/lib/bs/./src/legacy
2829
Opens from bsconfig:
2930
locItems:
30-
0:18-0:21 Typed map (Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b> GlobalReference
31+
1:18-1:21 Typed map (Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b> GlobalReference
3132
[ref] Typed GlobalReference moduleName:Belt path:List.map tip:Value
3233
fileForModule Impl cmt:tests/node_modules/rescript/lib/ocaml/belt.cmt res:tests/node_modules/rescript/lib/ocaml/belt.ml
3334
resolvePath path:List.map
@@ -40,9 +41,9 @@ resolvePath path:map
4041
[ref] Inner uri belt_List.mli
4142
{"uri": "belt_List.mli", "range": {"start": {"line": 239, "character": 4}, "end": {"line": 239, "character": 7}}}
4243

43-
Debug tests/src/Debug.res 3:14
44+
Definition tests/src/Debug.res 4:14
4445
locItems:
45-
3:13-3:16 Typed map ('a => 'b, list<'a>) => list<'b> GlobalReference
46+
4:13-4:16 Typed map ('a => 'b, list<'a>) => list<'b> GlobalReference
4647
[ref] Typed GlobalReference moduleName:List path:map tip:Value
4748
fileForModule Impl cmt:tests/node_modules/rescript/lib/ocaml/list.cmti res:tests/node_modules/rescript/lib/ocaml/list.mli
4849
resolvePath path:map
@@ -52,3 +53,4 @@ resolvePath path:map
5253
[ref] Inner uri list.mli
5354
{"uri": "list.mli", "range": {"start": {"line": 116, "character": 4}, "end": {"line": 116, "character": 7}}}
5455

56+

0 commit comments

Comments
 (0)