aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/algo.rs12
-rw-r--r--crates/ra_syntax/src/lib.rs5
-rw-r--r--crates/ra_syntax/src/syntax_node.rs8
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;
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///
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;
37use crate::syntax_node::GreenNode; 37use crate::syntax_node::GreenNode;
38 38
39pub use crate::{ 39pub 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};
49pub use ra_parser::SyntaxKind; 50pub 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::{
17pub use rowan::WalkEvent; 17pub use rowan::WalkEvent;
18pub(crate) use rowan::{GreenNode, GreenToken}; 18pub(crate) use rowan::{GreenNode, GreenToken};
19 19
20#[derive(Debug, PartialEq, Eq, Clone, Copy)]
21pub 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)]
29pub enum RustLanguage {} 21pub enum RustLanguage {}
30impl Language for RustLanguage { 22impl Language for RustLanguage {