Update crates/ide_assists/src/handlers/generate_constant.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
龙方淞 2021-10-06 10:06:51 +08:00 committed by GitHub
parent fab238adf6
commit 7228dbadca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,14 +57,13 @@ pub(crate) fn generate_constant(acc: &mut Assists, ctx: &AssistContext) -> Optio
"Generate constant", "Generate constant",
target, target,
|builder| { |builder| {
builder.replace( builder.insert(
statement.syntax().text_range(), statement.syntax().text_range.start(),
format!( format!(
"const {}: {} = $0;\n{}{}", "const {}: {} = $0;\n{}",
constant_token, constant_token,
type_name, type_name,
indent, indent
statement_syntax.text()
), ),
); );
}, },