diff options
Diffstat (limited to 'crates/ra_assists/src/assist_ctx.rs')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 2fe7c3de3..3155a469b 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -1,12 +1,12 @@ | |||
1 | //! This module defines `AssistCtx` -- the API surface that is exposed to assists. | 1 | //! This module defines `AssistCtx` -- the API surface that is exposed to assists. |
2 | use hir::Semantics; | 2 | use hir::Semantics; |
3 | use ra_db::FileRange; | 3 | use ra_db::{FileRange, Upcast}; |
4 | use ra_fmt::{leading_indent, reindent}; | 4 | use ra_fmt::{leading_indent, reindent}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ra_ide_db::RootDatabase; |
6 | use ra_syntax::{ | 6 | use ra_syntax::{ |
7 | algo::{self, find_covering_element, find_node_at_offset}, | 7 | algo::{self, find_covering_element, find_node_at_offset}, |
8 | AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize, | 8 | ast, AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, |
9 | TokenAtOffset, | 9 | TextSize, TokenAtOffset, |
10 | }; | 10 | }; |
11 | use ra_text_edit::TextEditBuilder; | 11 | use ra_text_edit::TextEditBuilder; |
12 | 12 | ||
@@ -136,6 +136,9 @@ impl<'a> AssistCtx<'a> { | |||
136 | pub(crate) fn covering_node_for_range(&self, range: TextRange) -> SyntaxElement { | 136 | pub(crate) fn covering_node_for_range(&self, range: TextRange) -> SyntaxElement { |
137 | find_covering_element(self.source_file.syntax(), range) | 137 | find_covering_element(self.source_file.syntax(), range) |
138 | } | 138 | } |
139 | pub(crate) fn lower_path(&self, path: ast::Path) -> Option<hir::Path> { | ||
140 | hir::Path::from_src(path, &hir::Hygiene::new(self.db.upcast(), self.frange.file_id.into())) | ||
141 | } | ||
139 | } | 142 | } |
140 | 143 | ||
141 | pub(crate) struct AssistGroup<'a> { | 144 | pub(crate) struct AssistGroup<'a> { |