aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_lsp_server/src/conv.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index 22b8e9221..687663d8a 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -364,14 +364,19 @@ pub fn to_location_link(
364 let url = target.info.file_id().try_conv_with(world)?; 364 let url = target.info.file_id().try_conv_with(world)?;
365 let tgt_line_index = world.analysis().file_line_index(target.info.file_id()); 365 let tgt_line_index = world.analysis().file_line_index(target.info.file_id());
366 366
367 let target_range = target.info.full_range().conv_with(&tgt_line_index);
368
369 let target_selection_range = target
370 .info
371 .focus_range()
372 .map(|it| it.conv_with(&tgt_line_index))
373 .unwrap_or(target_range);
374
367 let res = LocationLink { 375 let res = LocationLink {
368 origin_selection_range: Some(target.range.conv_with(line_index)), 376 origin_selection_range: Some(target.range.conv_with(line_index)),
369 target_uri: url.to_string(), 377 target_uri: url.to_string(),
370 target_range: target.info.full_range().conv_with(&tgt_line_index), 378 target_range,
371 target_selection_range: target 379 target_selection_range: Some(target_selection_range),
372 .info
373 .focus_range()
374 .map(|it| it.conv_with(&tgt_line_index)),
375 }; 380 };
376 Ok(res) 381 Ok(res)
377} 382}