mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-19 01:50:32 +00:00
Attribute completion is context aware
This commit is contained in:
parent
01bfc5f5c0
commit
fc37e2f953
4 changed files with 150 additions and 28 deletions
|
@ -243,6 +243,13 @@ impl ast::Path {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn as_single_name_ref(&self) -> Option<ast::NameRef> {
|
||||
match self.qualifier() {
|
||||
Some(_) => None,
|
||||
None => self.segment()?.name_ref(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn first_qualifier_or_self(&self) -> ast::Path {
|
||||
successors(Some(self.clone()), ast::Path::qualifier).last().unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue