aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-09 14:54:24 +0000
committerGitHub <[email protected]>2021-03-09 14:54:24 +0000
commit472641fc5beee1f998d46de70351bcb572d6226c (patch)
tree270af227656315f97ac84fda8ecfeb941399ac83 /crates
parentab99eff7b68ea327c2d327e96e7f8e0119a08516 (diff)
parenta1f080138ae6f45088ba48ac4f24834a85d14c66 (diff)
Merge #7941
7941: Fix unused definitions not being document highlit r=Veykril a=Veykril Fixes #7939 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/handlers.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 2c4c339cb..b5b2ffe50 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -1134,20 +1134,13 @@ pub(crate) fn handle_document_highlight(
1134 None 1134 None
1135 }; 1135 };
1136 1136
1137 let res = refs 1137 let file_refs = refs.references.get(&position.file_id).map_or(&[][..], Vec::as_slice);
1138 .references 1138 let mut res = Vec::with_capacity(file_refs.len() + 1);
1139 .get(&position.file_id) 1139 res.extend(decl);
1140 .map(|file_refs| { 1140 res.extend(file_refs.iter().map(|&(range, access)| DocumentHighlight {
1141 file_refs 1141 range: to_proto::range(&line_index, range),
1142 .into_iter() 1142 kind: access.map(to_proto::document_highlight_kind),
1143 .map(|&(range, access)| DocumentHighlight { 1143 }));
1144 range: to_proto::range(&line_index, range),
1145 kind: access.map(to_proto::document_highlight_kind),
1146 })
1147 .chain(decl)
1148 .collect()
1149 })
1150 .unwrap_or_default();
1151 Ok(Some(res)) 1144 Ok(Some(res))
1152} 1145}
1153 1146