Merge #11609
11609: Add another case to the syntax fixup code r=flodiebold a=flodiebold Co-authored-by: Florian Diebold <flodiebold@gmail.com>
This commit is contained in:
commit
f470f35abf
@ -97,6 +97,18 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
|
||||
]);
|
||||
}
|
||||
},
|
||||
ast::LetStmt(it) => {
|
||||
if it.semicolon_token().is_none() {
|
||||
append.insert(node.clone(), vec![
|
||||
SyntheticToken {
|
||||
kind: SyntaxKind::SEMICOLON,
|
||||
text: ";".into(),
|
||||
range: end_range,
|
||||
id: EMPTY_ID,
|
||||
},
|
||||
]);
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@ -229,6 +241,34 @@ fn foo () {a . __ra_fixup ; bar () ;}
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incomplete_let() {
|
||||
check(
|
||||
r#"
|
||||
fn foo() {
|
||||
let x = a
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
fn foo () {let x = a ;}
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incomplete_field_expr_in_let() {
|
||||
check(
|
||||
r#"
|
||||
fn foo() {
|
||||
let x = a.
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
fn foo () {let x = a . __ra_fixup ;}
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn field_expr_before_call() {
|
||||
// another case that easily happens while typing
|
||||
|
Loading…
x
Reference in New Issue
Block a user