diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-13 19:44:26 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-13 19:44:26 +0000 |
commit | a901cb4f342b0a784e716e29934999cc036dc835 (patch) | |
tree | 86883dcec047ed076e3b921d8d1b78fcd1fe4e23 /crates/ra_lsp_server | |
parent | fa6e4b7978621ef97446a497cfb195ed0ae04058 (diff) | |
parent | 5498a202b6abf87427f928a6cea870e30f2c88ff (diff) |
Merge #533
533: target_selection_range is not nullable in the implementation r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/conv.rs | 15 |
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 | } |