diff options
author | vsrs <[email protected]> | 2020-09-02 15:27:57 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-09-29 13:29:20 +0100 |
commit | 1895716c885eba9aae710f80f4c29eb2b424c6f0 (patch) | |
tree | f18ed9c1032465e8c715a5fdc66c7373b94bd1fb /crates/ide/src/lib.rs | |
parent | 06fbd6905014b90aa2efc1f67b92f31845011d76 (diff) |
Do not show references CodeLens for tests.
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r-- | crates/ide/src/lib.rs | 17 |
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; | |||
38 | mod matching_brace; | 38 | mod matching_brace; |
39 | mod parent_module; | 39 | mod parent_module; |
40 | mod references; | 40 | mod references; |
41 | mod fn_references; | ||
41 | mod runnables; | 42 | mod runnables; |
42 | mod status; | 43 | mod status; |
43 | mod syntax_highlighting; | 44 | mod 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 | }; |
59 | use syntax::{SourceFile, SyntaxKind, TextRange, TextSize}; | 60 | use syntax::{SourceFile, TextRange, TextSize}; |
60 | 61 | ||
61 | use crate::display::ToNav; | 62 | use 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. |