Skip to content

Commit c7fefd5

Browse files
committed
fix: add semicolon completion to mod
1 parent 4e1a3da commit c7fefd5

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Binary file not shown.

crates/ide-completion/src/completions/mod_.rs

+20
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub(crate) fn complete_mod(
5353
let existing_mod_declarations = current_module
5454
.children(ctx.db)
5555
.filter_map(|module| Some(module.name(ctx.db)?.to_string()))
56+
.filter(|module| module != ctx.original_token.text())
5657
.collect::<FxHashSet<_>>();
5758

5859
let module_declaration_file =
@@ -351,4 +352,23 @@ fn ignored_bar() {}
351352
"#]],
352353
);
353354
}
355+
356+
#[test]
357+
fn semi_colon_completion() {
358+
check(
359+
r#"
360+
//- /lib.rs
361+
mod foo;
362+
//- /foo.rs
363+
mod bar {
364+
mod baz$0
365+
}
366+
//- /foo/bar/baz.rs
367+
fn baz() {}
368+
"#,
369+
expect![[r#"
370+
md baz;
371+
"#]],
372+
);
373+
}
354374
}

0 commit comments

Comments
 (0)