aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r--crates/ra_analysis/src/lib.rs28
1 files changed, 4 insertions, 24 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index b068119d2..4d895b004 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -15,6 +15,7 @@ macro_rules! ctry {
15mod db; 15mod db;
16mod imp; 16mod imp;
17mod completion; 17mod completion;
18mod goto_defenition;
18mod symbol_index; 19mod symbol_index;
19pub mod mock_analysis; 20pub mod mock_analysis;
20mod runnables; 21mod runnables;
@@ -273,26 +274,6 @@ impl<T> RangeInfo<T> {
273 } 274 }
274} 275}
275 276
276/// Result of "goto def" query.
277#[derive(Debug)]
278pub struct ReferenceResolution {
279 /// The range of the reference itself. Client does not know what constitutes
280 /// a reference, it handles us only the offset. It's helpful to tell the
281 /// client where the reference was.
282 pub reference_range: TextRange,
283 /// What this reference resolves to.
284 pub resolves_to: Vec<NavigationTarget>,
285}
286
287impl ReferenceResolution {
288 fn new(reference_range: TextRange) -> ReferenceResolution {
289 ReferenceResolution {
290 reference_range,
291 resolves_to: Vec::new(),
292 }
293 }
294}
295
296/// `AnalysisHost` stores the current state of the world. 277/// `AnalysisHost` stores the current state of the world.
297#[derive(Debug, Default)] 278#[derive(Debug, Default)]
298pub struct AnalysisHost { 279pub struct AnalysisHost {
@@ -392,12 +373,11 @@ impl Analysis {
392 .collect(); 373 .collect();
393 Ok(res) 374 Ok(res)
394 } 375 }
395 /// Resolves reference to definition, but does not gurantee correctness. 376 pub fn goto_defenition(
396 pub fn approximately_resolve_symbol(
397 &self, 377 &self,
398 position: FilePosition, 378 position: FilePosition,
399 ) -> Cancelable<Option<ReferenceResolution>> { 379 ) -> Cancelable<Option<Vec<NavigationTarget>>> {
400 self.db.approximately_resolve_symbol(position) 380 goto_defenition::goto_defenition(&*self.db, position)
401 } 381 }
402 /// Finds all usages of the reference at point. 382 /// Finds all usages of the reference at point.
403 pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> { 383 pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> {