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

Commit d4ac5d9

Browse files
committed
Remove JsonShort
1 parent 67269e4 commit d4ac5d9

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

src/EditorSupportCommands.ml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
module J = JsonShort
2-
31
let dumpLocations state ~package ~file ~extra ~selectPos uri =
42
let locations =
53
extra.SharedTypes.locations
@@ -19,11 +17,11 @@ let dumpLocations state ~package ~file ~extra ~selectPos uri =
1917
let isCandidate = String.length hover > 10 in
2018
if isCandidate then (
2119
match Hashtbl.find_opt dedupTable hover with
22-
| Some n -> J.s ("#" ^ string_of_int n)
20+
| Some n -> Json.String ("#" ^ string_of_int n)
2321
| None ->
2422
Hashtbl.replace dedupTable hover i;
25-
J.s hover )
26-
else J.s hover
23+
Json.String hover )
24+
else Json.String hover
2725
in
2826
let locationsInfo =
2927
locations
@@ -66,7 +64,7 @@ let dumpLocations state ~package ~file ~extra ~selectPos uri =
6664
(
6765
[
6866
("definition",
69-
J.o
67+
Json.Object
7068
(match uriIsCurrentFile with
7169
| true -> [range]
7270
| false -> [("uri", Json.String (Uri2.toString uri2)); range])
@@ -78,10 +76,9 @@ let dumpLocations state ~package ~file ~extra ~selectPos uri =
7876
let skip = skipZero || (hover = [] && def = []) in
7977
match skip with
8078
| true -> None
81-
| false -> Some (J.o ([("range", Protocol.rangeOfLoc location)] @ hover @ def)))
82-
|> J.l
79+
| false -> Some (Json.Object ([("range", Protocol.rangeOfLoc location)] @ hover @ def)))
8380
in
84-
Json.stringify locationsInfo
81+
Json.stringify (Json.Array locationsInfo)
8582

8683
(* Split (line,char) from filepath:line:char *)
8784
let splitLineChar pathWithPos =

src/JsonShort.ml

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Protocol.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
module J = JsonShort
2-
31
let posOfLexing {Lexing.pos_lnum; pos_cnum; pos_bol} =
4-
J.o [("line", J.i (pos_lnum - 1)); ("character", J.i (pos_cnum - pos_bol))]
2+
Json.Object [("line", Json.Number (float_of_int (pos_lnum - 1))); ("character", Json.Number (float_of_int (pos_cnum - pos_bol)))]
53

64
let rangeOfLoc {Location.loc_start; loc_end} =
7-
J.o [("start", posOfLexing loc_start); ("end", posOfLexing loc_end)]
5+
Json.Object [("start", posOfLexing loc_start); ("end", posOfLexing loc_end)]
86

97
let array l = "[" ^ (String.concat ", " l) ^ "]"
108

0 commit comments

Comments
 (0)