Merge imports assist

Work towards #2220
This commit is contained in:
Aleksey Kladov 2020-03-18 16:41:24 +01:00
parent 4e50efcfc5
commit 3f6dc20d3c
8 changed files with 225 additions and 25 deletions

View file

@ -167,6 +167,20 @@ impl ast::UseTreeList {
.and_then(ast::UseTree::cast)
.expect("UseTreeLists are always nested in UseTrees")
}
pub fn l_curly(&self) -> Option<SyntaxToken> {
self.token(T!['{'])
}
pub fn r_curly(&self) -> Option<SyntaxToken> {
self.token(T!['}'])
}
fn token(&self, kind: SyntaxKind) -> Option<SyntaxToken> {
self.syntax()
.children_with_tokens()
.filter_map(|it| it.into_token())
.find(|it| it.kind() == kind)
}
}
impl ast::ImplDef {