aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r--crates/ide/src/lib.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 286a6a110..31f2bcba3 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -38,6 +38,7 @@ mod join_lines;
38mod matching_brace; 38mod matching_brace;
39mod parent_module; 39mod parent_module;
40mod references; 40mod references;
41mod fn_references;
41mod runnables; 42mod runnables;
42mod status; 43mod status;
43mod syntax_highlighting; 44mod syntax_highlighting;
@@ -56,7 +57,7 @@ use ide_db::{
56 symbol_index::{self, FileSymbol}, 57 symbol_index::{self, FileSymbol},
57 LineIndexDatabase, 58 LineIndexDatabase,
58}; 59};
59use syntax::{SourceFile, SyntaxKind, TextRange, TextSize}; 60use syntax::{SourceFile, TextRange, TextSize};
60 61
61use crate::display::ToNav; 62use crate::display::ToNav;
62 63
@@ -369,19 +370,9 @@ impl Analysis {
369 }) 370 })
370 } 371 }
371 372
372 /// Finds all methods and free functions for the file. 373 /// Finds all methods and free functions for the file. Does not return tests!
373 pub fn find_all_methods(&self, file_id: FileId) -> Cancelable<Vec<FileRange>> { 374 pub fn find_all_methods(&self, file_id: FileId) -> Cancelable<Vec<FileRange>> {
374 let res = self 375 self.with_db(|db| fn_references::find_all_methods(db, file_id))
375 .file_structure(file_id)?
376 .into_iter()
377 .filter(|it| match it.kind {
378 SyntaxKind::FN => true,
379 _ => false,
380 })
381 .filter_map(|it| Some(FileRange { file_id, range: it.navigation_range }))
382 .collect();
383
384 Ok(res)
385 } 376 }
386 377
387 /// Returns a short text describing element at position. 378 /// Returns a short text describing element at position.