From 5498a202b6abf87427f928a6cea870e30f2c88ff Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jan 2019 22:42:42 +0300 Subject: target_selection_range is not nullable in the implementation --- crates/ra_lsp_server/src/conv.rs | 15 ++++++++++----- 1 file 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( let url = target.info.file_id().try_conv_with(world)?; let tgt_line_index = world.analysis().file_line_index(target.info.file_id()); + let target_range = target.info.full_range().conv_with(&tgt_line_index); + + let target_selection_range = target + .info + .focus_range() + .map(|it| it.conv_with(&tgt_line_index)) + .unwrap_or(target_range); + let res = LocationLink { origin_selection_range: Some(target.range.conv_with(line_index)), target_uri: url.to_string(), - target_range: target.info.full_range().conv_with(&tgt_line_index), - target_selection_range: target - .info - .focus_range() - .map(|it| it.conv_with(&tgt_line_index)), + target_range, + target_selection_range: Some(target_selection_range), }; Ok(res) } -- cgit v1.2.3