target_selection_range is not nullable in the implementation

This commit is contained in:
Aleksey Kladov 2019-01-13 22:42:42 +03:00
parent fa6e4b7978
commit 5498a202b6

View file

@ -364,14 +364,19 @@ pub fn to_location_link(
let url = target.info.file_id().try_conv_with(world)?; let url = target.info.file_id().try_conv_with(world)?;
let tgt_line_index = world.analysis().file_line_index(target.info.file_id()); 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 { let res = LocationLink {
origin_selection_range: Some(target.range.conv_with(line_index)), origin_selection_range: Some(target.range.conv_with(line_index)),
target_uri: url.to_string(), target_uri: url.to_string(),
target_range: target.info.full_range().conv_with(&tgt_line_index), target_range,
target_selection_range: target target_selection_range: Some(target_selection_range),
.info
.focus_range()
.map(|it| it.conv_with(&tgt_line_index)),
}; };
Ok(res) Ok(res)
} }