From b88775af7fdfb06df922325ab48237592d5afecb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 7 Jan 2019 16:53:24 +0300 Subject: migrate ra_editor to rowan 0.2 --- crates/ra_editor/src/assists.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ra_editor/src/assists.rs') diff --git a/crates/ra_editor/src/assists.rs b/crates/ra_editor/src/assists.rs index 57b78342a..a320caabf 100644 --- a/crates/ra_editor/src/assists.rs +++ b/crates/ra_editor/src/assists.rs @@ -12,7 +12,7 @@ mod split_import; use ra_text_edit::{TextEdit, TextEditBuilder}; use ra_syntax::{ - Direction, SyntaxNodeRef, TextUnit, TextRange,SourceFileNode, AstNode, + Direction, SyntaxNode, TextUnit, TextRange, SourceFile, AstNode, algo::{find_leaf_at_offset, find_covering_node, LeafAtOffset}, }; @@ -28,7 +28,7 @@ pub use self::{ }; /// Return all the assists applicable at the given position. -pub fn assists(file: &SourceFileNode, range: TextRange) -> Vec { +pub fn assists(file: &SourceFile, range: TextRange) -> Vec { let ctx = AssistCtx::new(file, range); [ flip_comma, @@ -50,7 +50,7 @@ pub struct LocalEdit { pub cursor_position: Option, } -fn non_trivia_sibling(node: SyntaxNodeRef, direction: Direction) -> Option { +fn non_trivia_sibling(node: &SyntaxNode, direction: Direction) -> Option<&SyntaxNode> { node.siblings(direction) .skip(1) .find(|node| !node.kind().is_trivia()) @@ -88,7 +88,7 @@ fn non_trivia_sibling(node: SyntaxNodeRef, direction: Direction) -> Option { - source_file: &'a SourceFileNode, + source_file: &'a SourceFile, range: TextRange, should_compute_edit: bool, } @@ -106,7 +106,7 @@ struct AssistBuilder { } impl<'a> AssistCtx<'a> { - pub fn new(source_file: &'a SourceFileNode, range: TextRange) -> AssistCtx { + pub fn new(source_file: &'a SourceFile, range: TextRange) -> AssistCtx { AssistCtx { source_file, range, @@ -145,13 +145,13 @@ impl<'a> AssistCtx<'a> { })) } - pub(crate) fn leaf_at_offset(&self) -> LeafAtOffset> { + pub(crate) fn leaf_at_offset(&self) -> LeafAtOffset<&'a SyntaxNode> { find_leaf_at_offset(self.source_file.syntax(), self.range.start()) } - pub(crate) fn node_at_offset>(&self) -> Option { + pub(crate) fn node_at_offset(&self) -> Option<&'a N> { find_node_at_offset(self.source_file.syntax(), self.range.start()) } - pub(crate) fn covering_node(&self) -> SyntaxNodeRef<'a> { + pub(crate) fn covering_node(&self) -> &'a SyntaxNode { find_covering_node(self.source_file.syntax(), self.range) } } -- cgit v1.2.3