mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Merge #7941
7941: Fix unused definitions not being document highlit r=Veykril a=Veykril Fixes #7939 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
472641fc5b
1 changed files with 7 additions and 14 deletions
|
@ -1134,20 +1134,13 @@ pub(crate) fn handle_document_highlight(
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let res = refs
|
let file_refs = refs.references.get(&position.file_id).map_or(&[][..], Vec::as_slice);
|
||||||
.references
|
let mut res = Vec::with_capacity(file_refs.len() + 1);
|
||||||
.get(&position.file_id)
|
res.extend(decl);
|
||||||
.map(|file_refs| {
|
res.extend(file_refs.iter().map(|&(range, access)| DocumentHighlight {
|
||||||
file_refs
|
range: to_proto::range(&line_index, range),
|
||||||
.into_iter()
|
kind: access.map(to_proto::document_highlight_kind),
|
||||||
.map(|&(range, access)| DocumentHighlight {
|
}));
|
||||||
range: to_proto::range(&line_index, range),
|
|
||||||
kind: access.map(to_proto::document_highlight_kind),
|
|
||||||
})
|
|
||||||
.chain(decl)
|
|
||||||
.collect()
|
|
||||||
})
|
|
||||||
.unwrap_or_default();
|
|
||||||
Ok(Some(res))
|
Ok(Some(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue