@@ -85,7 +85,6 @@ let hover ~path ~line ~col =
85
85
| None -> Protocol. null
86
86
| Some s -> Protocol. stringifyHover {contents = s}))
87
87
in
88
-
89
88
print_endline result
90
89
91
90
let definition ~path ~line ~col =
@@ -126,37 +125,36 @@ let definition ~path ~line ~col =
126
125
127
126
print_endline result
128
127
129
- let references ~file ~line ~col ~extra ~package =
130
- let pos = Utils. protocolLineColToCmtLoc ~line ~col in
131
- match References. locItemForPos ~extra pos with
132
- | None -> Protocol. null
133
- | Some locItem ->
134
- let allReferences =
135
- References. allReferencesForLocItem ~package ~file ~extra locItem
136
- in
137
- let allLocs =
138
- allReferences
139
- |> List. fold_left
140
- (fun acc (uri2 , references ) ->
141
- (references
142
- |> List. map (fun loc ->
143
- Protocol. stringifyLocation
144
- {
145
- uri = Uri2. toString uri2;
146
- range = Utils. cmtLocToRange loc;
147
- }))
148
- @ acc)
149
- []
150
- in
151
- " [\n " ^ (allLocs |> String. concat " ,\n " ) ^ " \n ]"
152
-
153
128
let references ~path ~line ~col =
154
129
let uri = Uri2. fromLocalPath path in
155
130
let result =
156
131
match ProcessCmt. getFullFromCmt ~uri with
157
132
| Error _message -> Protocol. null
158
- | Ok (package , {file; extra} ) -> references ~file ~line ~col ~extra ~package
133
+ | Ok (package , {file; extra} ) -> (
134
+ let pos = Utils. protocolLineColToCmtLoc ~line ~col in
135
+ match References. locItemForPos ~extra pos with
136
+ | None -> Protocol. null
137
+ | Some locItem ->
138
+ let allReferences =
139
+ References. allReferencesForLocItem ~package ~file ~extra locItem
140
+ in
141
+ let allLocs =
142
+ allReferences
143
+ |> List. fold_left
144
+ (fun acc (uri2 , references ) ->
145
+ (references
146
+ |> List. map (fun loc ->
147
+ Protocol. stringifyLocation
148
+ {
149
+ uri = Uri2. toString uri2;
150
+ range = Utils. cmtLocToRange loc;
151
+ }))
152
+ @ acc)
153
+ []
154
+ in
155
+ " [\n " ^ (allLocs |> String. concat " ,\n " ) ^ " \n ]" )
159
156
in
157
+
160
158
print_endline result
161
159
162
160
let documentSymbol ~path =
0 commit comments