Improve keyword completion for 'let' and 'let mut'

This commit is contained in:
Tongjun Gao 2025-03-04 11:50:11 +08:00
parent 02862f5d52
commit 0b9dbe7426
2 changed files with 32 additions and 1 deletions

View file

@ -365,7 +365,8 @@ pub(crate) fn complete_expr_path(
add_keyword("false", "false");
if in_condition || in_block_expr {
add_keyword("let", "let");
add_keyword("let mut", "let mut $0");
add_keyword("let", "let $0");
}
if after_if_expr {

View file

@ -330,4 +330,34 @@ fn main() {
",
)
}
#[test]
fn completes_let_with_space() {
check_edit(
"let",
r#"
fn main() {
$0
}
"#,
r#"
fn main() {
let $0
}
"#,
);
check_edit(
"let mut",
r#"
fn main() {
$0
}
"#,
r#"
fn main() {
let mut $0
}
"#,
);
}
}