diff options
author | Aleksey Kladov <[email protected]> | 2018-08-17 19:10:55 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-17 19:10:55 +0100 |
commit | 70097504f78c4c41368a0b864a94df95fb9c27f7 (patch) | |
tree | c4034cab3c0d0b9488c0be538ae1d4c286570de9 /crates/libeditor/src | |
parent | ed7ae78c6fd9e508f6e959c6a164cf8481f6b377 (diff) |
hide root
Diffstat (limited to 'crates/libeditor/src')
-rw-r--r-- | crates/libeditor/src/code_actions.rs | 5 | ||||
-rw-r--r-- | crates/libeditor/src/symbols.rs | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/crates/libeditor/src/code_actions.rs b/crates/libeditor/src/code_actions.rs index 4b2515835..bb6eb0d61 100644 --- a/crates/libeditor/src/code_actions.rs +++ b/crates/libeditor/src/code_actions.rs | |||
@@ -2,8 +2,7 @@ use {TextUnit, File, EditBuilder, Edit}; | |||
2 | use libsyntax2::{ | 2 | use libsyntax2::{ |
3 | ast::{self, AstNode, AttrsOwner}, | 3 | ast::{self, AstNode, AttrsOwner}, |
4 | SyntaxKind::COMMA, | 4 | SyntaxKind::COMMA, |
5 | SyntaxNodeRef, | 5 | SyntaxNodeRef, RefRoot, |
6 | SyntaxRoot, | ||
7 | algo::{ | 6 | algo::{ |
8 | Direction, siblings, | 7 | Direction, siblings, |
9 | find_leaf_at_offset, ancestors, | 8 | find_leaf_at_offset, ancestors, |
@@ -71,7 +70,7 @@ fn non_trivia_sibling(node: SyntaxNodeRef, direction: Direction) -> Option<Synta | |||
71 | .find(|node| !node.kind().is_trivia()) | 70 | .find(|node| !node.kind().is_trivia()) |
72 | } | 71 | } |
73 | 72 | ||
74 | pub fn find_node<'a, N: AstNode<&'a SyntaxRoot>>(syntax: SyntaxNodeRef<'a>, offset: TextUnit) -> Option<N> { | 73 | pub fn find_node<'a, N: AstNode<RefRoot<'a>>>(syntax: SyntaxNodeRef<'a>, offset: TextUnit) -> Option<N> { |
75 | let leaves = find_leaf_at_offset(syntax, offset); | 74 | let leaves = find_leaf_at_offset(syntax, offset); |
76 | let leaf = leaves.clone() | 75 | let leaf = leaves.clone() |
77 | .find(|leaf| !leaf.kind().is_trivia()) | 76 | .find(|leaf| !leaf.kind().is_trivia()) |
diff --git a/crates/libeditor/src/symbols.rs b/crates/libeditor/src/symbols.rs index ce870430e..cf5bd2a41 100644 --- a/crates/libeditor/src/symbols.rs +++ b/crates/libeditor/src/symbols.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use smol_str::SmolStr; | 1 | use smol_str::SmolStr; |
2 | use libsyntax2::{ | 2 | use libsyntax2::{ |
3 | SyntaxKind, SyntaxNodeRef, SyntaxRoot, AstNode, | 3 | SyntaxKind, SyntaxNodeRef, AstNode, RefRoot, |
4 | ast::{self, NameOwner}, | 4 | ast::{self, NameOwner}, |
5 | algo::{ | 5 | algo::{ |
6 | visit::{visitor, Visitor}, | 6 | visit::{visitor, Visitor}, |
@@ -32,7 +32,7 @@ pub fn file_symbols(file: &ast::File) -> Vec<FileSymbol> { | |||
32 | } | 32 | } |
33 | 33 | ||
34 | fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> { | 34 | fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> { |
35 | fn decl<'a, N: NameOwner<&'a SyntaxRoot>>(node: N) -> Option<FileSymbol> { | 35 | fn decl<'a, N: NameOwner<RefRoot<'a>>>(node: N) -> Option<FileSymbol> { |
36 | let name = node.name()?; | 36 | let name = node.name()?; |
37 | Some(FileSymbol { | 37 | Some(FileSymbol { |
38 | name: name.text(), | 38 | name: name.text(), |
@@ -80,7 +80,7 @@ pub fn file_structure(file: &ast::File) -> Vec<StructureNode> { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | fn structure_node(node: SyntaxNodeRef) -> Option<StructureNode> { | 82 | fn structure_node(node: SyntaxNodeRef) -> Option<StructureNode> { |
83 | fn decl<'a, N: NameOwner<&'a SyntaxRoot>>(node: N) -> Option<StructureNode> { | 83 | fn decl<'a, N: NameOwner<RefRoot<'a>>>(node: N) -> Option<StructureNode> { |
84 | let name = node.name()?; | 84 | let name = node.name()?; |
85 | Some(StructureNode { | 85 | Some(StructureNode { |
86 | parent: None, | 86 | parent: None, |