aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorvsrs <[email protected]>2020-09-02 14:03:05 +0100
committervsrs <[email protected]>2020-09-29 13:29:20 +0100
commit06fbd6905014b90aa2efc1f67b92f31845011d76 (patch)
tree6d1471eeb05f7275850690b037be23e82f01263f /crates/ide
parentb7fda5f936737aa1111599f93cb3133fa7f65ee4 (diff)
Make method references CodeLens lazy.
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/lib.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 4763c0aac..286a6a110 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -56,7 +56,7 @@ use ide_db::{
56 symbol_index::{self, FileSymbol}, 56 symbol_index::{self, FileSymbol},
57 LineIndexDatabase, 57 LineIndexDatabase,
58}; 58};
59use syntax::{SourceFile, TextRange, TextSize}; 59use syntax::{SourceFile, SyntaxKind, TextRange, TextSize};
60 60
61use crate::display::ToNav; 61use crate::display::ToNav;
62 62
@@ -369,6 +369,21 @@ impl Analysis {
369 }) 369 })
370 } 370 }
371 371
372 /// Finds all methods and free functions for the file.
373 pub fn find_all_methods(&self, file_id: FileId) -> Cancelable<Vec<FileRange>> {
374 let res = self
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 }
386
372 /// Returns a short text describing element at position. 387 /// Returns a short text describing element at position.
373 pub fn hover( 388 pub fn hover(
374 &self, 389 &self,