aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-21 11:28:58 +0100
committerAleksey Kladov <[email protected]>2019-07-21 11:28:58 +0100
commitd52ee59a712932bc381d8c690dc2f681598760fe (patch)
treef1fd1615203dd5552172cc35e0b6c5c9b76104c2 /crates/ra_assists/src
parent62be91b82d6368a20a40893b199bc4f7a35a2223 (diff)
streamline API
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/assist_ctx.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs
index 4d5a76de6..a12c3ed54 100644
--- a/crates/ra_assists/src/assist_ctx.rs
+++ b/crates/ra_assists/src/assist_ctx.rs
@@ -2,8 +2,9 @@ use hir::db::HirDatabase;
2use ra_db::FileRange; 2use ra_db::FileRange;
3use ra_fmt::{leading_indent, reindent}; 3use ra_fmt::{leading_indent, reindent};
4use ra_syntax::{ 4use ra_syntax::{
5 algo::{find_covering_element, find_node_at_offset, find_token_at_offset, TokenAtOffset}, 5 algo::{find_covering_element, find_node_at_offset},
6 AstNode, SourceFile, SyntaxElement, SyntaxNode, SyntaxToken, TextRange, TextUnit, 6 AstNode, SourceFile, SyntaxElement, SyntaxNode, SyntaxToken, TextRange, TextUnit,
7 TokenAtOffset,
7}; 8};
8use ra_text_edit::TextEditBuilder; 9use ra_text_edit::TextEditBuilder;
9 10
@@ -105,7 +106,7 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> {
105 } 106 }
106 107
107 pub(crate) fn token_at_offset(&self) -> TokenAtOffset<SyntaxToken> { 108 pub(crate) fn token_at_offset(&self) -> TokenAtOffset<SyntaxToken> {
108 find_token_at_offset(self.source_file.syntax(), self.frange.range.start()) 109 self.source_file.syntax().token_at_offset(self.frange.range.start())
109 } 110 }
110 111
111 pub(crate) fn node_at_offset<N: AstNode>(&self) -> Option<N> { 112 pub(crate) fn node_at_offset<N: AstNode>(&self) -> Option<N> {