aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ids.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-03 18:31:41 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-03 18:31:41 +0000
commit2fcc6bdafa1caffd4ddf98968ee967e9fb091cc0 (patch)
tree5a278ad534d2de9f308bbdfef323c3b20bf9a653 /crates/ra_hir/src/ids.rs
parent6c0bca5984a6b66d306f9a413b0433c15d450500 (diff)
parentd61707b4e1f0bdfc7f62b1abf78fdc45c0128699 (diff)
Merge #421
421: Index macros r=matklad a=matklad So, this is pretty cool! We now index items which are the result of macro expansion! (of a single currently hard-coded macro). So, workspace symbols can now be used to navigate to `HirDatabase`, for example Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r--crates/ra_hir/src/ids.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index a09dee8b1..4c7ebe3ea 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -48,6 +48,13 @@ impl HirFileId {
48 } 48 }
49 } 49 }
50 50
51 pub(crate) fn as_macro_call_id(self) -> Option<MacroCallId> {
52 match self.0 {
53 HirFileIdRepr::Macro(it) => Some(it),
54 _ => None,
55 }
56 }
57
51 pub(crate) fn hir_source_file(db: &impl HirDatabase, file_id: HirFileId) -> SourceFileNode { 58 pub(crate) fn hir_source_file(db: &impl HirDatabase, file_id: HirFileId) -> SourceFileNode {
52 match file_id.0 { 59 match file_id.0 {
53 HirFileIdRepr::File(file_id) => db.source_file(file_id), 60 HirFileIdRepr::File(file_id) => db.source_file(file_id),