mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-19 08:34:09 +00:00
use nodes from actual file
This commit is contained in:
parent
784379eb79
commit
c4cff80269
1 changed files with 16 additions and 9 deletions
|
@ -883,18 +883,25 @@ fn classify_name_ref(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let make_path_kind_type = |ty: ast::Type| {
|
let make_path_kind_type = |ty: ast::Type| {
|
||||||
let location = type_location(ty.syntax());
|
let location = type_location(ty.syntax()).unwrap_or(TypeLocation::Other);
|
||||||
if let Some(p) = ty.syntax().parent() {
|
match &location {
|
||||||
if ast::GenericArg::can_cast(p.kind()) || ast::GenericArgList::can_cast(p.kind()) {
|
TypeLocation::TupleField => (),
|
||||||
if let Some(p) = p.parent().and_then(|p| p.parent()) {
|
TypeLocation::TypeAscription(_) => (),
|
||||||
if let Some(segment) = ast::PathSegment::cast(p) {
|
TypeLocation::GenericArgList(args) => {
|
||||||
let path = segment.parent_path().top_path();
|
dbg!(&args);
|
||||||
dbg!(sema.resolve_path(&path));
|
if let Some(segment) =
|
||||||
}
|
args.as_ref().and_then(|args| ast::PathSegment::cast(args.syntax().parent()?))
|
||||||
|
{
|
||||||
|
let path = dbg!(segment.parent_path().top_path());
|
||||||
|
dbg!(sema.resolve_path(&path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TypeLocation::TypeBound => (),
|
||||||
|
TypeLocation::ImplTarget => (),
|
||||||
|
TypeLocation::ImplTrait => (),
|
||||||
|
TypeLocation::Other => (),
|
||||||
}
|
}
|
||||||
PathKind::Type { location: location.unwrap_or(TypeLocation::Other) }
|
PathKind::Type { location }
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut kind_macro_call = |it: ast::MacroCall| {
|
let mut kind_macro_call = |it: ast::MacroCall| {
|
||||||
|
|
Loading…
Reference in a new issue