aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/algo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/algo.rs')
-rw-r--r--crates/ra_syntax/src/algo.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs
index 6bb46b021..ecd42c133 100644
--- a/crates/ra_syntax/src/algo.rs
+++ b/crates/ra_syntax/src/algo.rs
@@ -5,8 +5,8 @@ use std::ops::RangeInclusive;
5use itertools::Itertools; 5use itertools::Itertools;
6 6
7use crate::{ 7use crate::{
8 AstNode, Direction, InsertPosition, NodeOrToken, SourceFile, SyntaxElement, SyntaxNode, 8 AstNode, Direction, NodeOrToken, SourceFile, SyntaxElement, SyntaxNode, SyntaxNodePtr,
9 SyntaxNodePtr, SyntaxToken, TextRange, TextUnit, 9 SyntaxToken, TextRange, TextUnit,
10}; 10};
11 11
12pub use rowan::TokenAtOffset; 12pub use rowan::TokenAtOffset;
@@ -61,6 +61,14 @@ pub fn find_covering_element(root: &SyntaxNode, range: TextRange) -> SyntaxEleme
61 root.covering_element(range) 61 root.covering_element(range)
62} 62}
63 63
64#[derive(Debug, PartialEq, Eq, Clone, Copy)]
65pub enum InsertPosition<T> {
66 First,
67 Last,
68 Before(T),
69 After(T),
70}
71
64/// Adds specified children (tokens or nodes) to the current node at the 72/// Adds specified children (tokens or nodes) to the current node at the
65/// specific position. 73/// specific position.
66/// 74///