Smart completing anonymous object: follow code style settings (KT-29572)
#KT-29572 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
e1f26ffc74
commit
e06514c945
+5
-1
@@ -40,6 +40,7 @@ import org.jetbrains.kotlin.idea.core.KotlinIndicesHelper
|
||||
import org.jetbrains.kotlin.idea.core.Tail
|
||||
import org.jetbrains.kotlin.idea.core.multipleFuzzyTypes
|
||||
import org.jetbrains.kotlin.idea.core.overrideImplement.ImplementMembersHandler
|
||||
import org.jetbrains.kotlin.idea.formatter.ktCodeStyleSettings
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.util.*
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
@@ -191,7 +192,10 @@ class TypeInstantiationItems(
|
||||
insertHandler = InsertHandler<LookupElement> { context, _ ->
|
||||
val startOffset = context.startOffset
|
||||
|
||||
val text1 = "object : $typeText"
|
||||
val settings = ktCodeStyleSettings(context.project)?.custom
|
||||
val spaceBefore = if (settings?.SPACE_BEFORE_EXTEND_COLON == true) " " else ""
|
||||
val spaceAfter = if (settings?.SPACE_AFTER_EXTEND_COLON == true) " " else ""
|
||||
val text1 = "object$spaceBefore:$spaceAfter$typeText"
|
||||
val text2 = "$constructorParenthesis {}"
|
||||
val text = if (allTypeArgsKnown)
|
||||
text1 + IdeDescriptorRenderers.SOURCE_CODE.renderTypeArguments(typeArgsToUse) + text2
|
||||
|
||||
Reference in New Issue
Block a user