Adapt to PSI parsing change for property accessor with parenthesis

^KT-70922

GitOrigin-RevId: 210c5987f4162929d76a52b3827ffc852b5d0b3a
This commit is contained in:
Jinseong Jeon
2024-10-02 09:10:30 +00:00
committed by intellij-monorepo-bot
parent 92be60ae77
commit d52ec27b27
7 changed files with 9 additions and 12 deletions
@@ -27,7 +27,9 @@ class KotlinPropertySetterParametersFixer : SmartEnterProcessorWithFixers.Fixer<
val doc = editor.document
val parameterOffset = (psiElement.leftParenthesis?.node?.startOffset ?: return) + 1
val leftParenthesis = psiElement.leftParenthesis ?: psiElement.parameterList?.leftParenthesis
val parameterOffset = (leftParenthesis?.node?.startOffset ?: return) + 1
if (parameter?.text.isNullOrBlank()) {
if (psiElement.rightParenthesis == null) {
@@ -331,7 +331,7 @@ class KotlinTypedHandler : TypedHandlerDelegate() {
}
c == '(' -> {
if (KotlinTypedHandlerHelper.autoIndentCase(editor, project, file, KtPropertyAccessor::class.java, forFirstElement = false)) return Result.STOP
if (KotlinTypedHandlerHelper.autoIndentCase(editor, project, file, KtParameterList::class.java, forFirstElement = false)) return Result.STOP
}
}
@@ -165,8 +165,7 @@ fun KtDeclaration.isEffectivelyActual(checkConstructor: Boolean = true): Boolean
}
fun KtPropertyAccessor.deleteBody() {
val leftParenthesis = leftParenthesis ?: return
deleteChildRange(leftParenthesis, lastChild)
deleteChildRange(parameterList ?: return, lastChild)
}
/**
@@ -4,5 +4,4 @@ class Test {
)
}
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
// IGNORE_FORMATTER
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
@@ -2,5 +2,4 @@ class Test {
val a: Boolean get(<caret>)
}
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
// IGNORE_FORMATTER
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
@@ -6,5 +6,4 @@ class Test {
)
}
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
// IGNORE_FORMATTER
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
@@ -4,5 +4,4 @@ class Test {
set(<caret>)
}
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
// IGNORE_FORMATTER
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS