@@ -3,55 +3,62 @@ let help =
3
3
** Private CLI For rescript- vscode usage only**
4
4
5
5
Examples :
6
- ./ run.exe dump src/ MyFile. res src/ MyFile2. res
7
6
./ run.exe complete src/ MyFile. res 0 4 currentContent.res
8
- ./ run.exe hover src/ MyFile. res 10 2
9
7
./ run.exe definition src/ MyFile. res 9 3
8
+ ./ run.exe dump src/ MyFile. res src/ MyFile2. res
9
+ ./ run.exe documentSymbol src/ Foo. res
10
+ ./ run.exe hover src/ MyFile. res 10 2
11
+ ./ run.exe references src/ MyFile. res 10 2
12
+ ./ run.exe test src/ MyFile. res
10
13
11
14
Note : coordinates are zero- based, so the first position is 0 0.
12
15
13
16
Options :
14
- dump : debugging . definition and hover for Foo .res and Foo2 .res :
17
+ complete : compute autocomplete for MyFile .res at line 0 and column 4 ,
18
+ where MyFile .res is being edited and the editor content is in file current .res.
15
19
16
- ./ run.exe dump src / Foo .res src / Foo2 .res
20
+ ./ run.exe complete src / MyFile .res 0 4 current .res
17
21
18
- complete : compute autocomplete for Foo .res at line 0 and column 4 ,
19
- where Foo .res is being edited and the editor content is in file current .res.
22
+ definition : get definition for item in MyFile .res at line 10 column 2 :
20
23
21
- ./ run.exe complete src / Foo .res 0 4 current .res
24
+ ./ run.exe definition src / MyFile .res 10 2
22
25
23
- hover : get inferred type for Foo .res at line 10 column 2 :
26
+ dump : for debugging , show all definitions and hovers for MyFile .res and MyFile .res :
24
27
25
- ./ run.exe hover src / Foo .res 10 2
28
+ ./ run.exe dump src / Foo .res src / MyFile .res
26
29
27
- definition : get definition for item in Foo .res at line 10 column 2 :
30
+ documentSymbol : get all symbols declared in MyFile .res
28
31
29
- ./ run.exe definition src / Foo .res 10 2
32
+ ./ run.exe documentSymbol src / MyFile .res
30
33
31
- references : get references to item in Foo .res at line 10 column 2 :
34
+ hover : get inferred type for MyFile .res at line 10 column 2 :
32
35
33
- ./ run.exe references src / Foo .res 10 2
36
+ ./ run.exe hover src / MyFile .res 10 2
34
37
35
- documentSymbol : get all symbols in Foo .res :
38
+ references : get all references to item in MyFile .res at line 10 column 2 :
36
39
37
- ./ run.exe documentSymbol src / Foo .res
38
- |}
40
+ ./ run.exe references src / MyFile .res 10 2
41
+
42
+ test : run tests specified by special comments in file src / MyFile .res
43
+
44
+ ./ run.exe test src / src/ MyFile .res
45
+ |}
39
46
40
47
let main () =
41
48
match Array. to_list Sys. argv with
42
49
| [_; " complete" ; path; line; col; currentFile] ->
43
50
Commands. complete ~path ~line: (int_of_string line) ~col: (int_of_string col)
44
51
~current File
45
- | [_; " hover" ; path; line; col] ->
46
- Commands. hover ~path ~line: (int_of_string line) ~col: (int_of_string col)
47
52
| [_; " definition" ; path; line; col] ->
48
53
Commands. definition ~path ~line: (int_of_string line)
49
54
~col: (int_of_string col)
55
+ | _ :: "dump" :: files -> Commands. dump files
56
+ | [_; " documentSymbol" ; path] -> Commands. documentSymbol ~path
57
+ | [_; " hover" ; path; line; col] ->
58
+ Commands. hover ~path ~line: (int_of_string line) ~col: (int_of_string col)
50
59
| [_; " references" ; path; line; col] ->
51
60
Commands. references ~path ~line: (int_of_string line)
52
61
~col: (int_of_string col)
53
- | [_; " documentSymbol" ; path] -> Commands. documentSymbol ~path
54
- | _ :: "dump" :: files -> Commands. dump files
55
62
| [_; " test" ; path] -> Commands. test ~path
56
63
| args when List. mem " -h" args || List. mem " --help" args -> prerr_endline help
57
64
| _ ->
0 commit comments