fix: add semicolon completion to mod

This commit is contained in:
Peh 2022-09-08 22:37:31 +01:00
parent 4e1a3da8f2
commit c7fefd5223
2 changed files with 20 additions and 0 deletions

Binary file not shown.

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