diff options
author | Lukas Wirth <[email protected]> | 2021-03-15 08:32:06 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-03-15 08:32:06 +0000 |
commit | 9763d9e8c4ca01a4df0d70877020ec7351403b75 (patch) | |
tree | b007710dcc6152b5c0fedd1c0bedf8c96811652d /crates/rust-analyzer/src/handlers.rs | |
parent | c0459c53572f90fa9134192e432562af3daba5fa (diff) |
Enable searching for builtin types
Diffstat (limited to 'crates/rust-analyzer/src/handlers.rs')
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 6cc433cb8..9bb82164d 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -828,9 +828,9 @@ pub(crate) fn handle_references( | |||
828 | }; | 828 | }; |
829 | 829 | ||
830 | let decl = if params.context.include_declaration { | 830 | let decl = if params.context.include_declaration { |
831 | Some(FileRange { | 831 | refs.declaration.map(|decl| FileRange { |
832 | file_id: refs.declaration.nav.file_id, | 832 | file_id: decl.nav.file_id, |
833 | range: refs.declaration.nav.focus_or_full_range(), | 833 | range: decl.nav.focus_or_full_range(), |
834 | }) | 834 | }) |
835 | } else { | 835 | } else { |
836 | None | 836 | None |
@@ -1135,14 +1135,12 @@ pub(crate) fn handle_document_highlight( | |||
1135 | Some(refs) => refs, | 1135 | Some(refs) => refs, |
1136 | }; | 1136 | }; |
1137 | 1137 | ||
1138 | let decl = if refs.declaration.nav.file_id == position.file_id { | 1138 | let decl = refs.declaration.filter(|decl| decl.nav.file_id == position.file_id).map(|decl| { |
1139 | Some(DocumentHighlight { | 1139 | DocumentHighlight { |
1140 | range: to_proto::range(&line_index, refs.declaration.nav.focus_or_full_range()), | 1140 | range: to_proto::range(&line_index, decl.nav.focus_or_full_range()), |
1141 | kind: refs.declaration.access.map(to_proto::document_highlight_kind), | 1141 | kind: decl.access.map(to_proto::document_highlight_kind), |
1142 | }) | 1142 | } |
1143 | } else { | 1143 | }); |
1144 | None | ||
1145 | }; | ||
1146 | 1144 | ||
1147 | let file_refs = refs.references.get(&position.file_id).map_or(&[][..], Vec::as_slice); | 1145 | let file_refs = refs.references.get(&position.file_id).map_or(&[][..], Vec::as_slice); |
1148 | let mut res = Vec::with_capacity(file_refs.len() + 1); | 1146 | let mut res = Vec::with_capacity(file_refs.len() + 1); |