@@ -703,9 +703,10 @@ pub trait ILanguageClient: IVim {
703
703
Ok ( result)
704
704
}
705
705
706
- fn textDocument_definition ( & self , params : & Option < Params > ) -> Result < Value > {
706
+ /// Generic find locations, e.g, definitions, references.
707
+ fn find_locations ( & self , method_name : & str , params : & Option < Params > ) -> Result < Value > {
707
708
self . textDocument_didChange ( params) ?;
708
- info ! ( "Begin {}" , lsp :: request :: GotoDefinition :: METHOD ) ;
709
+ info ! ( "Begin {}" , method_name ) ;
709
710
let ( buftype, languageId, filename, line, character, goto_cmd, handle) : (
710
711
String ,
711
712
String ,
@@ -732,7 +733,7 @@ pub trait ILanguageClient: IVim {
732
733
733
734
let result = self . call (
734
735
Some ( & languageId) ,
735
- lsp :: request :: GotoDefinition :: METHOD ,
736
+ method_name ,
736
737
TextDocumentPositionParams {
737
738
text_document : TextDocumentIdentifier {
738
739
uri : filename. to_url ( ) ?,
@@ -775,7 +776,7 @@ pub trait ILanguageClient: IVim {
775
776
} ,
776
777
} ;
777
778
778
- info ! ( "End {}" , lsp :: request :: GotoDefinition :: METHOD ) ;
779
+ info ! ( "End {}" , method_name ) ;
779
780
Ok ( result)
780
781
}
781
782
@@ -2160,194 +2161,6 @@ pub trait ILanguageClient: IVim {
2160
2161
info ! ( "End {}" , NOTIFICATION__CqueryProgress ) ;
2161
2162
Ok ( ( ) )
2162
2163
}
2163
-
2164
- fn cquery_base ( & self , params : & Option < Params > ) -> Result < Value > {
2165
- info ! ( "Begin {}" , REQUEST__CqueryBase ) ;
2166
-
2167
- let ( buftype, languageId, filename, line, character, handle) : (
2168
- String ,
2169
- String ,
2170
- String ,
2171
- u64 ,
2172
- u64 ,
2173
- bool ,
2174
- ) = self . gather_args (
2175
- & [
2176
- VimVar :: Buftype ,
2177
- VimVar :: LanguageId ,
2178
- VimVar :: Filename ,
2179
- VimVar :: Line ,
2180
- VimVar :: Character ,
2181
- VimVar :: Handle ,
2182
- ] ,
2183
- params,
2184
- ) ?;
2185
- if !buftype. is_empty ( ) || languageId. is_empty ( ) {
2186
- return Ok ( Value :: Null ) ;
2187
- }
2188
-
2189
- let result = self . call (
2190
- Some ( & languageId) ,
2191
- REQUEST__CqueryBase ,
2192
- TextDocumentPositionParams {
2193
- text_document : TextDocumentIdentifier {
2194
- uri : filename. to_url ( ) ?,
2195
- } ,
2196
- position : Position { line, character } ,
2197
- } ,
2198
- ) ?;
2199
-
2200
- if !handle {
2201
- return Ok ( result) ;
2202
- }
2203
-
2204
- let locations: Vec < Location > = serde_json:: from_value ( result. clone ( ) ) ?;
2205
- self . display_locations ( & locations, & languageId) ?;
2206
-
2207
- info ! ( "End {}" , REQUEST__CqueryBase ) ;
2208
- Ok ( result)
2209
- }
2210
-
2211
- fn cquery_derived ( & self , params : & Option < Params > ) -> Result < Value > {
2212
- info ! ( "Begin {}" , REQUEST__CqueryDerived ) ;
2213
-
2214
- let ( buftype, languageId, filename, line, character, handle) : (
2215
- String ,
2216
- String ,
2217
- String ,
2218
- u64 ,
2219
- u64 ,
2220
- bool ,
2221
- ) = self . gather_args (
2222
- & [
2223
- VimVar :: Buftype ,
2224
- VimVar :: LanguageId ,
2225
- VimVar :: Filename ,
2226
- VimVar :: Line ,
2227
- VimVar :: Character ,
2228
- VimVar :: Handle ,
2229
- ] ,
2230
- params,
2231
- ) ?;
2232
- if !buftype. is_empty ( ) || languageId. is_empty ( ) {
2233
- return Ok ( Value :: Null ) ;
2234
- }
2235
-
2236
- let result = self . call (
2237
- Some ( & languageId) ,
2238
- REQUEST__CqueryDerived ,
2239
- TextDocumentPositionParams {
2240
- text_document : TextDocumentIdentifier {
2241
- uri : filename. to_url ( ) ?,
2242
- } ,
2243
- position : Position { line, character } ,
2244
- } ,
2245
- ) ?;
2246
-
2247
- if !handle {
2248
- return Ok ( result) ;
2249
- }
2250
-
2251
- let locations: Vec < Location > = serde_json:: from_value ( result. clone ( ) ) ?;
2252
- self . display_locations ( & locations, & languageId) ?;
2253
-
2254
- info ! ( "End {}" , REQUEST__CqueryDerived ) ;
2255
- Ok ( result)
2256
- }
2257
-
2258
- fn cquery_callers ( & self , params : & Option < Params > ) -> Result < Value > {
2259
- info ! ( "Begin {}" , REQUEST__CqueryCallers ) ;
2260
-
2261
- let ( buftype, languageId, filename, line, character, handle) : (
2262
- String ,
2263
- String ,
2264
- String ,
2265
- u64 ,
2266
- u64 ,
2267
- bool ,
2268
- ) = self . gather_args (
2269
- & [
2270
- VimVar :: Buftype ,
2271
- VimVar :: LanguageId ,
2272
- VimVar :: Filename ,
2273
- VimVar :: Line ,
2274
- VimVar :: Character ,
2275
- VimVar :: Handle ,
2276
- ] ,
2277
- params,
2278
- ) ?;
2279
- if !buftype. is_empty ( ) || languageId. is_empty ( ) {
2280
- return Ok ( Value :: Null ) ;
2281
- }
2282
-
2283
- let result = self . call (
2284
- Some ( & languageId) ,
2285
- REQUEST__CqueryCallers ,
2286
- TextDocumentPositionParams {
2287
- text_document : TextDocumentIdentifier {
2288
- uri : filename. to_url ( ) ?,
2289
- } ,
2290
- position : Position { line, character } ,
2291
- } ,
2292
- ) ?;
2293
-
2294
- if !handle {
2295
- return Ok ( result) ;
2296
- }
2297
-
2298
- let locations: Vec < Location > = serde_json:: from_value ( result. clone ( ) ) ?;
2299
- self . display_locations ( & locations, & languageId) ?;
2300
-
2301
- info ! ( "End {}" , REQUEST__CqueryCallers ) ;
2302
- Ok ( result)
2303
- }
2304
-
2305
- fn cquery_vars ( & self , params : & Option < Params > ) -> Result < Value > {
2306
- info ! ( "Begin {}" , REQUEST__CqueryVars ) ;
2307
-
2308
- let ( buftype, languageId, filename, line, character, handle) : (
2309
- String ,
2310
- String ,
2311
- String ,
2312
- u64 ,
2313
- u64 ,
2314
- bool ,
2315
- ) = self . gather_args (
2316
- & [
2317
- VimVar :: Buftype ,
2318
- VimVar :: LanguageId ,
2319
- VimVar :: Filename ,
2320
- VimVar :: Line ,
2321
- VimVar :: Character ,
2322
- VimVar :: Handle ,
2323
- ] ,
2324
- params,
2325
- ) ?;
2326
- if !buftype. is_empty ( ) || languageId. is_empty ( ) {
2327
- return Ok ( Value :: Null ) ;
2328
- }
2329
-
2330
- let result = self . call (
2331
- Some ( & languageId) ,
2332
- REQUEST__CqueryVars ,
2333
- TextDocumentPositionParams {
2334
- text_document : TextDocumentIdentifier {
2335
- uri : filename. to_url ( ) ?,
2336
- } ,
2337
- position : Position { line, character } ,
2338
- } ,
2339
- ) ?;
2340
-
2341
- if !handle {
2342
- return Ok ( result) ;
2343
- }
2344
-
2345
- let locations: Vec < Location > = serde_json:: from_value ( result. clone ( ) ) ?;
2346
- self . display_locations ( & locations, & languageId) ?;
2347
-
2348
- info ! ( "End {}" , REQUEST__CqueryVars ) ;
2349
- Ok ( result)
2350
- }
2351
2164
}
2352
2165
2353
2166
impl ILanguageClient for Arc < RwLock < State > > {
0 commit comments