mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-28 06:14:22 +00:00
Don't insert imports outside of cfg attributed items
This commit is contained in:
parent
d9666ce509
commit
344cb5e76a
4 changed files with 118 additions and 32 deletions
|
@ -8,7 +8,7 @@ use parser::SyntaxKind;
|
|||
use rowan::{GreenNodeData, GreenTokenData};
|
||||
|
||||
use crate::{
|
||||
ast::{self, support, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode},
|
||||
ast::{self, support, AstChildren, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode},
|
||||
NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T,
|
||||
};
|
||||
|
||||
|
@ -45,6 +45,12 @@ fn text_of_first_token(node: &SyntaxNode) -> TokenText<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ast::BlockExpr {
|
||||
pub fn items(&self) -> AstChildren<ast::Item> {
|
||||
support::children(self.syntax())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum Macro {
|
||||
MacroRules(ast::MacroRules),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue