mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +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
|
let existing_mod_declarations = current_module
|
||||||
.children(ctx.db)
|
.children(ctx.db)
|
||||||
.filter_map(|module| Some(module.name(ctx.db)?.to_string()))
|
.filter_map(|module| Some(module.name(ctx.db)?.to_string()))
|
||||||
|
.filter(|module| module != ctx.original_token.text())
|
||||||
.collect::<FxHashSet<_>>();
|
.collect::<FxHashSet<_>>();
|
||||||
|
|
||||||
let module_declaration_file =
|
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…
Add table
Add a link
Reference in a new issue