⬆️ rowan
This commit is contained in:
@@ -214,8 +214,7 @@ fn with_children(
|
||||
new_children: Vec<NodeOrToken<rowan::GreenNode, rowan::GreenToken>>,
|
||||
) -> SyntaxNode {
|
||||
let len = new_children.iter().map(|it| it.text_len()).sum::<TextUnit>();
|
||||
let new_node =
|
||||
rowan::GreenNode::new(rowan::cursor::SyntaxKind(parent.kind() as u16), new_children);
|
||||
let new_node = rowan::GreenNode::new(rowan::SyntaxKind(parent.kind() as u16), new_children);
|
||||
let new_root_node = parent.replace_with(new_node);
|
||||
let new_root_node = SyntaxNode::new_root(new_root_node);
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ fn reparse_token<'node>(
|
||||
}
|
||||
}
|
||||
|
||||
let new_token =
|
||||
GreenToken::new(rowan::cursor::SyntaxKind(token.kind().into()), text.into());
|
||||
let new_token = GreenToken::new(rowan::SyntaxKind(token.kind().into()), text.into());
|
||||
Some((token.replace_with(new_token), token.text_range()))
|
||||
}
|
||||
_ => None,
|
||||
|
||||
@@ -21,18 +21,18 @@ pub enum RustLanguage {}
|
||||
impl Language for RustLanguage {
|
||||
type Kind = SyntaxKind;
|
||||
|
||||
fn kind_from_raw(raw: rowan::cursor::SyntaxKind) -> SyntaxKind {
|
||||
fn kind_from_raw(raw: rowan::SyntaxKind) -> SyntaxKind {
|
||||
SyntaxKind::from(raw.0)
|
||||
}
|
||||
|
||||
fn kind_to_raw(kind: SyntaxKind) -> rowan::cursor::SyntaxKind {
|
||||
rowan::cursor::SyntaxKind(kind.into())
|
||||
fn kind_to_raw(kind: SyntaxKind) -> rowan::SyntaxKind {
|
||||
rowan::SyntaxKind(kind.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub type SyntaxNode = rowan::SyntaxNode<RustLanguage>;
|
||||
pub type SyntaxToken = rowan::SyntaxToken<RustLanguage>;
|
||||
pub type SyntaxElement = rowan::NodeOrToken<SyntaxNode, SyntaxToken>;
|
||||
pub type SyntaxElement = rowan::SyntaxElement<RustLanguage>;
|
||||
pub type SyntaxNodeChildren = rowan::SyntaxNodeChildren<RustLanguage>;
|
||||
pub type SyntaxElementChildren = rowan::SyntaxElementChildren<RustLanguage>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user