mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
fix: add semicolon completion to mod
This commit is contained in:
parent
4e1a3da8f2
commit
c7fefd5223
2 changed files with 20 additions and 0 deletions
BIN
crates/ide-completion/src/completions/.mod_.rs.swp
Normal file
BIN
crates/ide-completion/src/completions/.mod_.rs.swp
Normal file
Binary file not shown.
|
@ -53,6 +53,7 @@ pub(crate) fn complete_mod(
|
|||
let existing_mod_declarations = current_module
|
||||
.children(ctx.db)
|
||||
.filter_map(|module| Some(module.name(ctx.db)?.to_string()))
|
||||
.filter(|module| module != ctx.original_token.text())
|
||||
.collect::<FxHashSet<_>>();
|
||||
|
||||
let module_declaration_file =
|
||||
|
@ -351,4 +352,23 @@ fn ignored_bar() {}
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn semi_colon_completion() {
|
||||
check(
|
||||
r#"
|
||||
//- /lib.rs
|
||||
mod foo;
|
||||
//- /foo.rs
|
||||
mod bar {
|
||||
mod baz$0
|
||||
}
|
||||
//- /foo/bar/baz.rs
|
||||
fn baz() {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
md baz;
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue