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",
target,
|builder| {
builder.replace(
statement.syntax().text_range(),
builder.insert(
statement.syntax().text_range.start(),
format!(
"const {}: {} = $0;\n{}{}",
"const {}: {} = $0;\n{}",
constant_token,
type_name,
indent,
statement_syntax.text()
indent
),
);
},