diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/algo.rs | 12 | ||||
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/src/syntax_node.rs | 8 |
3 files changed, 13 insertions, 12 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; | |||
5 | use itertools::Itertools; | 5 | use itertools::Itertools; |
6 | 6 | ||
7 | use crate::{ | 7 | use 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 | ||
12 | pub use rowan::TokenAtOffset; | 12 | pub 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)] | ||
65 | pub 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 | /// |
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 21c07d69a..7b778f38c 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -37,13 +37,14 @@ use ra_text_edit::AtomTextEdit; | |||
37 | use crate::syntax_node::GreenNode; | 37 | use crate::syntax_node::GreenNode; |
38 | 38 | ||
39 | pub use crate::{ | 39 | pub use crate::{ |
40 | algo::InsertPosition, | ||
40 | ast::{AstNode, AstToken}, | 41 | ast::{AstNode, AstToken}, |
41 | parsing::{classify_literal, tokenize, Token}, | 42 | parsing::{classify_literal, tokenize, Token}, |
42 | ptr::{AstPtr, SyntaxNodePtr}, | 43 | ptr::{AstPtr, SyntaxNodePtr}, |
43 | syntax_error::{Location, SyntaxError, SyntaxErrorKind}, | 44 | syntax_error::{Location, SyntaxError, SyntaxErrorKind}, |
44 | syntax_node::{ | 45 | syntax_node::{ |
45 | Direction, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken, | 46 | Direction, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken, SyntaxTreeBuilder, |
46 | SyntaxTreeBuilder, WalkEvent, | 47 | WalkEvent, |
47 | }, | 48 | }, |
48 | }; | 49 | }; |
49 | pub use ra_parser::SyntaxKind; | 50 | pub use ra_parser::SyntaxKind; |
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs index 689dbefde..95795a27a 100644 --- a/crates/ra_syntax/src/syntax_node.rs +++ b/crates/ra_syntax/src/syntax_node.rs | |||
@@ -17,14 +17,6 @@ use crate::{ | |||
17 | pub use rowan::WalkEvent; | 17 | pub use rowan::WalkEvent; |
18 | pub(crate) use rowan::{GreenNode, GreenToken}; | 18 | pub(crate) use rowan::{GreenNode, GreenToken}; |
19 | 19 | ||
20 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] | ||
21 | pub enum InsertPosition<T> { | ||
22 | First, | ||
23 | Last, | ||
24 | Before(T), | ||
25 | After(T), | ||
26 | } | ||
27 | |||
28 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 20 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
29 | pub enum RustLanguage {} | 21 | pub enum RustLanguage {} |
30 | impl Language for RustLanguage { | 22 | impl Language for RustLanguage { |