Skip to content

Commit b7e8b9a

Browse files
committed
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.
2 parents 4e1a3da + bd3feea commit b7e8b9a

File tree

1 file changed

+20
-0
lines changed
  • crates/ide-completion/src/completions

1 file changed

+20
-0
lines changed

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)