add semicolon for block expr in introduce_variable

This commit is contained in:
Yerkebulan Tulibergenov 2019-01-13 18:22:53 -08:00
parent 1538ca3ae5
commit 5d6cf59f60

View file

@ -1,6 +1,6 @@
use ra_syntax::{
ast::{self, AstNode},
SyntaxKind::WHITESPACE,
SyntaxKind::{WHITESPACE, BLOCK_EXPR},
SyntaxNode, TextUnit,
};
@ -26,6 +26,9 @@ pub fn introduce_variable<'a>(ctx: AssistCtx) -> Option<Assist> {
false
};
if is_full_stmt {
if expr.syntax().kind() == BLOCK_EXPR {
buf.push_str(";");
}
edit.replace(expr.syntax().range(), buf);
} else {
buf.push_str(";");