Add braces to 'if' statement: save/restore comments correctly
So #KT-16332 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
b436ee6e19
commit
4726b44371
@@ -815,8 +815,10 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
|
||||
return createFunction("fun foo() {\n$bodyText\n}").bodyExpression as KtBlockExpression
|
||||
}
|
||||
|
||||
fun createSingleStatementBlock(statement: KtExpression): KtBlockExpression {
|
||||
return createDeclarationByPattern<KtNamedFunction>("fun foo() {\n$0\n}", statement).bodyExpression as KtBlockExpression
|
||||
fun createSingleStatementBlock(statement: KtExpression, prevComment: String? = null, nextComment: String? = null): KtBlockExpression {
|
||||
val prev = if (prevComment == null) "" else " $prevComment "
|
||||
val next = if (nextComment == null) "" else " $nextComment "
|
||||
return createDeclarationByPattern<KtNamedFunction>("fun foo() {\n$prev$0$next\n}", statement).bodyExpression as KtBlockExpression
|
||||
}
|
||||
|
||||
fun createComment(text: String): PsiComment {
|
||||
|
||||
Reference in New Issue
Block a user