Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/flyimport.rs')
| -rw-r--r-- | crates/ide-completion/src/tests/flyimport.rs | 117 |
1 files changed, 115 insertions, 2 deletions
diff --git a/crates/ide-completion/src/tests/flyimport.rs b/crates/ide-completion/src/tests/flyimport.rs index 8bba44c12b..27c91bc7c4 100644 --- a/crates/ide-completion/src/tests/flyimport.rs +++ b/crates/ide-completion/src/tests/flyimport.rs @@ -1810,9 +1810,10 @@ fn function() { #[test] fn excluded_trait_item_included_when_exact_match() { + // FIXME: This does not work, we need to change the code. check_with_config( CompletionConfig { - exclude_traits: &["test::module2::ExcludedTrait".to_owned()], + exclude_traits: &["ra_test_fixture::module2::ExcludedTrait".to_owned()], ..TEST_CONFIG }, r#" @@ -1830,8 +1831,120 @@ fn foo() { true.foo$0 } "#, + expect![""], + ); +} + +#[test] +fn excluded_via_attr() { + check( + r#" +mod module2 { + #[rust_analyzer::completions(ignore_flyimport)] + pub trait ExcludedTrait { + fn foo(&self) {} + fn bar(&self) {} + fn baz(&self) {} + } + + impl<T> ExcludedTrait for T {} +} + +fn foo() { + true.$0 +} + "#, + expect![""], + ); + check( + r#" +mod module2 { + #[rust_analyzer::completions(ignore_flyimport_methods)] + pub trait ExcludedTrait { + fn foo(&self) {} + fn bar(&self) {} + fn baz(&self) {} + } + + impl<T> ExcludedTrait for T {} +} + +fn foo() { + true.$0 +} + "#, + expect![""], + ); + check( + r#" +mod module2 { + #[rust_analyzer::completions(ignore_methods)] + pub trait ExcludedTrait { + fn foo(&self) {} + fn bar(&self) {} + fn baz(&self) {} + } + + impl<T> ExcludedTrait for T {} +} + +fn foo() { + true.$0 +} + "#, + expect![""], + ); + check( + r#" +mod module2 { + #[rust_analyzer::completions(ignore_flyimport)] + pub trait ExcludedTrait { + fn foo(&self) {} + fn bar(&self) {} + fn baz(&self) {} + } + + impl<T> ExcludedTrait for T {} +} + +fn foo() { + ExcludedTrait$0 +} + "#, + expect![""], + ); + check( + r#" +mod module2 { + #[rust_analyzer::completions(ignore_methods)] + pub trait ExcludedTrait { + fn foo(&self) {} + fn bar(&self) {} + fn baz(&self) {} + } + + impl<T> ExcludedTrait for T {} +} + +fn foo() { + ExcludedTrait$0 +} + "#, expect![[r#" - me foo() (use module2::ExcludedTrait) fn(&self) + tt ExcludedTrait (use module2::ExcludedTrait) "#]], ); + check( + r#" +mod module2 { + #[rust_analyzer::completions(ignore_flyimport)] + pub struct Foo {} +} + +fn foo() { + Foo$0 +} + "#, + expect![""], + ); } |