//! Entry point for call-hierarchy
-use indexmap::IndexMap;
-
use hir::Semantics;
use ide_db::{
defs::{Definition, NameClass, NameRefClass},
helpers::pick_best_token,
search::FileReference,
- RootDatabase,
+ FxIndexMap, RootDatabase,
};
-use syntax::{ast, AstNode, SyntaxKind::NAME, TextRange};
+use syntax::{ast, AstNode, SyntaxKind::IDENT, TextRange};
-use crate::{display::TryToNav, goto_definition, FilePosition, NavigationTarget, RangeInfo};
+use crate::{goto_definition, FilePosition, NavigationTarget, RangeInfo, TryToNav};
#[derive(Debug, Clone)]
pub struct CallItem {
let file = sema.parse(file_id);
let file = file.syntax();
let token = pick_best_token(file.token_at_offset(position.offset), |kind| match kind {
- NAME => 1,
+ IDENT => 1,
_ => 0,
})?;
let mut calls = CallLocations::default();
sema.descend_into_macros(token)
.into_iter()
- .filter_map(|it| it.ancestors().nth(1).and_then(ast::Item::cast))
+ .filter_map(|it| it.parent_ancestors().nth(1).and_then(ast::Item::cast))
.filter_map(|item| match item {
ast::Item::Const(c) => c.body().map(|it| it.syntax().descendants()),
ast::Item::Fn(f) => f.body().map(|it| it.syntax().descendants()),
#[derive(Default)]
struct CallLocations {
- funcs: IndexMap<NavigationTarget, Vec<TextRange>>,
+ funcs: FxIndexMap<NavigationTarget, Vec<TextRange>>,
}
impl CallLocations {