mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Merge #7487
7487: Forbid flyimport completions in use statements r=SomeoneToIgnore a=SomeoneToIgnore Closes #7469 Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
commit
0ac4a8f354
1 changed files with 22 additions and 1 deletions
|
@ -68,7 +68,10 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext)
|
||||||
if !ctx.config.enable_imports_on_the_fly {
|
if !ctx.config.enable_imports_on_the_fly {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if ctx.attribute_under_caret.is_some() || ctx.mod_declaration_under_caret.is_some() {
|
if ctx.use_item_syntax.is_some()
|
||||||
|
|| ctx.attribute_under_caret.is_some()
|
||||||
|
|| ctx.mod_declaration_under_caret.is_some()
|
||||||
|
{
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let potential_import_name = {
|
let potential_import_name = {
|
||||||
|
@ -664,4 +667,22 @@ fn main() {
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_completions_in_use_statements() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
//- /lib.rs crate:dep
|
||||||
|
pub mod io {
|
||||||
|
pub fn stdin() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//- /main.rs crate:main deps:dep
|
||||||
|
use stdi$0
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
"#,
|
||||||
|
expect![[]],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue