aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/assist_ctx.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-01-16 15:08:46 +0000
committerAleksey Kladov <[email protected]>2020-01-16 15:08:46 +0000
commit81a45ca1b3606d2c328740aa7e2dc989b9e128a5 (patch)
treebeb2951ab9f7a7ab1420cb072c8839957c6de02f /crates/ra_assists/src/assist_ctx.rs
parentf4eeff2c82e7d8b95706c2bcb0388eeeb3ddd24e (diff)
Make FromSource private
Diffstat (limited to 'crates/ra_assists/src/assist_ctx.rs')
-rw-r--r--crates/ra_assists/src/assist_ctx.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs
index 9d533fa0c..43f0d664b 100644
--- a/crates/ra_assists/src/assist_ctx.rs
+++ b/crates/ra_assists/src/assist_ctx.rs
@@ -1,6 +1,6 @@
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.
2use either::Either; 2use either::Either;
3use hir::{db::HirDatabase, InFile, SourceAnalyzer}; 3use hir::{db::HirDatabase, InFile, SourceAnalyzer, SourceBinder};
4use ra_db::FileRange; 4use ra_db::FileRange;
5use ra_fmt::{leading_indent, reindent}; 5use ra_fmt::{leading_indent, reindent};
6use ra_syntax::{ 6use ra_syntax::{
@@ -142,12 +142,16 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> {
142 pub(crate) fn covering_element(&self) -> SyntaxElement { 142 pub(crate) fn covering_element(&self) -> SyntaxElement {
143 find_covering_element(self.source_file.syntax(), self.frange.range) 143 find_covering_element(self.source_file.syntax(), self.frange.range)
144 } 144 }
145 pub(crate) fn source_binder(&self) -> SourceBinder<'a, DB> {
146 SourceBinder::new(self.db)
147 }
145 pub(crate) fn source_analyzer( 148 pub(crate) fn source_analyzer(
146 &self, 149 &self,
147 node: &SyntaxNode, 150 node: &SyntaxNode,
148 offset: Option<TextUnit>, 151 offset: Option<TextUnit>,
149 ) -> SourceAnalyzer { 152 ) -> SourceAnalyzer {
150 SourceAnalyzer::new(self.db, InFile::new(self.frange.file_id.into(), node), offset) 153 let src = InFile::new(self.frange.file_id.into(), node);
154 self.source_binder().analyze(src, offset)
151 } 155 }
152 156
153 pub(crate) fn covering_node_for_range(&self, range: TextRange) -> SyntaxElement { 157 pub(crate) fn covering_node_for_range(&self, range: TextRange) -> SyntaxElement {