Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit 200d86b

Browse files
committed
char -> col
1 parent 39c3687 commit 200d86b

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/EditorSupportCommands.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ let dump files =
106106
in
107107
print_endline result)
108108

109-
let complete ~path ~line ~char ~currentFile =
109+
let complete ~path ~line ~col ~currentFile =
110110
let state = TopTypes.empty () in
111111
let filePath = Files.maybeConcat (Unix.getcwd ()) path in
112112
let uri = Uri2.fromPath filePath in
@@ -118,19 +118,19 @@ let complete ~path ~line ~char ~currentFile =
118118
| Ok (package, full) ->
119119
let maybeText = Files.readFile currentFile in
120120
NewCompletions.computeCompletions ~full ~maybeText ~package
121-
~pos:(line, char) ~state
121+
~pos:(line, col) ~state
122122
|> List.map Protocol.stringifyCompletionItem
123123
|> Protocol.array
124124
in
125125
print_endline result
126126

127-
let hover state ~file ~line ~char ~extra ~package =
127+
let hover state ~file ~line ~col ~extra ~package =
128128
let locations =
129129
extra.SharedTypes.locations
130130
|> List.filter (fun (l, _) -> not l.Location.loc_ghost)
131131
in
132132
let locations =
133-
let pos = (line, char) in
133+
let pos = (line, col) in
134134
let pos = Utils.cmtLocFromVscode pos in
135135
match References.locForPos ~extra:{extra with locations} pos with
136136
| None -> []
@@ -181,26 +181,26 @@ let hover state ~file ~line ~char ~extra ~package =
181181
| [] -> Protocol.null
182182
| head :: _ -> Protocol.stringifyHover head
183183

184-
let hover ~path ~line ~char =
184+
let hover ~path ~line ~col =
185185
let state = TopTypes.empty () in
186186
let filePath = Files.maybeConcat (Unix.getcwd ()) path in
187187
let uri = Uri2.fromPath filePath in
188188
let result =
189189
match State.getFullFromCmt ~state ~uri with
190190
| Error message -> Protocol.stringifyHover {contents = message}
191191
| Ok (package, {file; extra}) ->
192-
hover state ~file ~line ~char ~extra ~package
192+
hover state ~file ~line ~col ~extra ~package
193193
in
194194
print_endline result
195195

196-
let definition state ~file ~line ~char ~extra ~package =
196+
let definition state ~file ~line ~col ~extra ~package =
197197
let open TopTypes in
198198
let locations =
199199
extra.SharedTypes.locations
200200
|> List.filter (fun (l, _) -> not l.Location.loc_ghost)
201201
in
202202
let locations =
203-
let pos = (line, char) in
203+
let pos = (line, col) in
204204
let pos = Utils.cmtLocFromVscode pos in
205205
match References.locForPos ~extra:{extra with locations} pos with
206206
| None -> []
@@ -243,14 +243,14 @@ let definition state ~file ~line ~char ~extra ~package =
243243
| [] -> Protocol.null
244244
| head :: _ -> Protocol.stringifyLocation head
245245

246-
let definition ~path ~line ~char =
246+
let definition ~path ~line ~col =
247247
let state = TopTypes.empty () in
248248
let filePath = Files.maybeConcat (Unix.getcwd ()) path in
249249
let uri = Uri2.fromPath filePath in
250250
let result =
251251
match State.getFullFromCmt ~state ~uri with
252252
| Error _message -> Protocol.null
253253
| Ok (package, {file; extra}) ->
254-
definition state ~file ~line ~char ~extra ~package
254+
definition state ~file ~line ~col ~extra ~package
255255
in
256256
print_endline result

src/RescriptEditorSupport.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ let main () =
5252
match parseArgs (Sys.argv |> Array.to_list) with
5353
| opts, _ when hasOpts opts ["-h"; "--help"] -> showHelp ()
5454
| _opts, "dump" :: files -> EditorSupportCommands.dump files
55-
| _opts, ["complete"; path; line; char; currentFile] ->
55+
| _opts, ["complete"; path; line; col; currentFile] ->
5656
EditorSupportCommands.complete ~path ~line:(int_of_string line)
57-
~char:(int_of_string char) ~currentFile
58-
| _opts, ["hover"; path; line; char] ->
59-
EditorSupportCommands.hover ~path ~line:(int_of_string line) ~char:(int_of_string char)
60-
| _opts, ["definition"; path; line; char] ->
61-
EditorSupportCommands.definition ~path ~line:(int_of_string line) ~char:(int_of_string char)
57+
~col:(int_of_string col) ~currentFile
58+
| _opts, ["hover"; path; line; col] ->
59+
EditorSupportCommands.hover ~path ~line:(int_of_string line) ~col:(int_of_string col)
60+
| _opts, ["definition"; path; line; col] ->
61+
EditorSupportCommands.definition ~path ~line:(int_of_string line) ~col:(int_of_string col)
6262
| _ ->
6363
showHelp ();
6464
exit 1

0 commit comments

Comments
 (0)