Add language to formatting blocks to fetch indent settings propertly
This commit is contained in:
@@ -20,7 +20,7 @@ import com.intellij.lang.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class KotlinLanguage extends Language {
|
||||
public static final KotlinLanguage INSTANCE = new KotlinLanguage();
|
||||
@NotNull public static final KotlinLanguage INSTANCE = new KotlinLanguage();
|
||||
public static final String NAME = "Kotlin";
|
||||
|
||||
private KotlinLanguage() {
|
||||
|
||||
@@ -24,8 +24,9 @@ import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||
import com.intellij.psi.formatter.FormatterUtil
|
||||
import com.intellij.psi.formatter.common.AbstractBlock
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import org.jetbrains.kotlin.KtNodeTypes.*
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.*
|
||||
import org.jetbrains.kotlin.KtNodeTypes.WHEN_ENTRY
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.ARROW
|
||||
|
||||
/**
|
||||
* @see Block for good JavaDoc documentation
|
||||
@@ -36,7 +37,7 @@ class KotlinBlock(
|
||||
private val myIndent: Indent?,
|
||||
wrap: Wrap?,
|
||||
mySettings: CodeStyleSettings,
|
||||
private val mySpacingBuilder: KotlinSpacingBuilder) : AbstractBlock(node, wrap, myAlignmentStrategy.getAlignment(node)) {
|
||||
private val mySpacingBuilder: KotlinSpacingBuilder) : AbstractBlock(node, wrap, myAlignmentStrategy.getAlignment(node)), BlockEx {
|
||||
|
||||
private val kotlinDelegationBlock = object : KotlinCommonBlock(node, mySettings, mySpacingBuilder, myAlignmentStrategy) {
|
||||
override fun getNullAlignmentStrategy(): CommonAlignmentStrategy = NodeAlignmentStrategy.getNullStrategy()
|
||||
@@ -91,6 +92,8 @@ class KotlinBlock(
|
||||
override fun getChildAttributes(newChildIndex: Int): ChildAttributes = kotlinDelegationBlock.getChildAttributes(newChildIndex)
|
||||
|
||||
override fun isLeaf(): Boolean = kotlinDelegationBlock.isLeaf()
|
||||
|
||||
override fun getLanguage() = KotlinLanguage.INSTANCE
|
||||
}
|
||||
|
||||
object KotlinSpacingBuilderUtilImpl : KotlinSpacingBuilderUtil {
|
||||
|
||||
Reference in New Issue
Block a user