Auto merge of #13207 - randomicon00:semicol#13196, r=lnicola

fix: add semicolon completion to mod

fixes #13196

`@Veykril` The tests are passing. I added one specifically for this case.
This commit is contained in:
bors 2022-09-09 04:15:20 +00:00
commit b7e8b9a6b8

View file

@ -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;
"#]],
);
}
}