aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop/handlers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index c25b63852..9b8d40eaa 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -460,6 +460,22 @@ pub fn handle_signature_help(
460 } 460 }
461} 461}
462 462
463pub fn handle_references(
464 world: ServerWorld,
465 params: req::ReferenceParams,
466 token: JobToken,
467) -> Result<Option<Vec<Location>>> {
468 let file_id = params.text_document.try_conv_with(&world)?;
469 let line_index = world.analysis().file_line_index(file_id);
470 let offset = params.position.conv_with(&line_index);
471
472 let refs = world.analysis().find_all_refs(file_id, offset, &token);
473
474 Ok(Some(refs.into_iter()
475 .filter_map(|r| to_location(r.0, r.1, &world, &line_index).ok())
476 .collect()))
477}
478
463pub fn handle_code_action( 479pub fn handle_code_action(
464 world: ServerWorld, 480 world: ServerWorld,
465 params: req::CodeActionParams, 481 params: req::CodeActionParams,