mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
respect "one" import granularity config in merge imports assist
This commit is contained in:
parent
4f176b3f7f
commit
7db4117156
3 changed files with 228 additions and 20 deletions
|
@ -327,6 +327,14 @@ impl ast::UseTree {
|
|||
pub fn parent_use_tree_list(&self) -> Option<ast::UseTreeList> {
|
||||
self.syntax().parent().and_then(ast::UseTreeList::cast)
|
||||
}
|
||||
|
||||
pub fn top_use_tree(&self) -> ast::UseTree {
|
||||
let mut this = self.clone();
|
||||
while let Some(use_tree_list) = this.parent_use_tree_list() {
|
||||
this = use_tree_list.parent_use_tree();
|
||||
}
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
impl ast::UseTreeList {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue