Insert empty lines after functions and properties (KT-4002)
#KT-4002 Fixed
This commit is contained in:
@@ -1,117 +1,121 @@
|
|||||||
<root>
|
<root>
|
||||||
<item name='com.intellij.formatting.Spacing com.intellij.formatting.Spacing createKeepingFirstColumnSpacing(int, int, boolean, int)'>
|
<item
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
name='com.intellij.formatting.DependentSpacingRule com.intellij.formatting.DependentSpacingRule registerData(com.intellij.formatting.DependentSpacingRule.Anchor, int)'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item name='com.intellij.formatting.Spacing com.intellij.formatting.Spacing createSpacing(int, int, int, boolean, int)'>
|
</item>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<item name='com.intellij.formatting.Spacing com.intellij.formatting.Spacing createKeepingFirstColumnSpacing(int, int, boolean, int)'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder append(com.intellij.formatting.SpacingBuilder)'>
|
</item>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<item name='com.intellij.formatting.Spacing com.intellij.formatting.Spacing createSpacing(int, int, int, boolean, int)'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item
|
</item>
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder after(com.intellij.psi.tree.IElementType)'>
|
<item name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder append(com.intellij.formatting.SpacingBuilder)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder afterInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder after(com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder afterInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.TokenSet)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder afterInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder afterInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder afterInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.TokenSet)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder around(com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder afterInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder around(com.intellij.psi.tree.TokenSet)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder around(com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder around(com.intellij.psi.tree.TokenSet)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.TokenSet)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.TokenSet)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.TokenSet)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder before(com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder aroundInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.TokenSet)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder beforeInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder before(com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder beforeInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder beforeInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder beforeInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.TokenSet)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.TokenSet)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.TokenSet)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder betweenInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder between(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.TokenSet)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder betweenInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder betweenInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder withinPair(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder betweenInside(com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.TokenSet, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder withinPairInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder withinPair(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder blankLines(int)'>
|
<item
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
name='com.intellij.formatting.SpacingBuilder com.intellij.formatting.SpacingBuilder.RuleBuilder withinPairInside(com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType, com.intellij.psi.tree.IElementType)'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder lineBreakInCode()'>
|
</item>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder blankLines(int)'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder lineBreakInCodeIf(boolean)'>
|
</item>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder lineBreakInCode()'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder none()'>
|
</item>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder lineBreakInCodeIf(boolean)'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder spaceIf(boolean)'>
|
</item>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder none()'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder spaces(int)'>
|
</item>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder spaceIf(boolean)'>
|
||||||
</item>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
<item
|
</item>
|
||||||
name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder spacing(int, int, int, boolean, int)'>
|
<item name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder spaces(int)'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
|
<item
|
||||||
|
name='com.intellij.formatting.SpacingBuilder.RuleBuilder com.intellij.formatting.SpacingBuilder spacing(int, int, int, boolean, int)'>
|
||||||
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
|
</item>
|
||||||
</root>
|
</root>
|
||||||
@@ -29,6 +29,11 @@ import com.intellij.formatting.ASTBlock
|
|||||||
import org.jetbrains.jet.plugin.formatter.KotlinSpacingBuilder.CustomSpacingBuilder
|
import org.jetbrains.jet.plugin.formatter.KotlinSpacingBuilder.CustomSpacingBuilder
|
||||||
import com.intellij.formatting.SpacingBuilder
|
import com.intellij.formatting.SpacingBuilder
|
||||||
import com.intellij.formatting.SpacingBuilder.RuleBuilder
|
import com.intellij.formatting.SpacingBuilder.RuleBuilder
|
||||||
|
import com.intellij.formatting.DependentSpacingRule
|
||||||
|
import com.intellij.formatting.DependentSpacingRule.Trigger
|
||||||
|
import com.intellij.formatting.DependentSpacingRule.Anchor
|
||||||
|
import com.intellij.openapi.util.TextRange
|
||||||
|
import com.intellij.formatting.DependantSpacingImpl
|
||||||
|
|
||||||
val MODIFIERS_LIST_ENTRIES = TokenSet.orSet(TokenSet.create(ANNOTATION_ENTRY, ANNOTATION), MODIFIER_KEYWORDS)
|
val MODIFIERS_LIST_ENTRIES = TokenSet.orSet(TokenSet.create(ANNOTATION_ENTRY, ANNOTATION), MODIFIER_KEYWORDS)
|
||||||
|
|
||||||
@@ -43,7 +48,31 @@ fun SpacingBuilder.afterInside(element: IElementType, tokenSet: TokenSet, spacin
|
|||||||
fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
|
fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
|
||||||
val jetSettings = settings.getCustomSettings(javaClass<JetCodeStyleSettings>())!!
|
val jetSettings = settings.getCustomSettings(javaClass<JetCodeStyleSettings>())!!
|
||||||
val jetCommonSettings = settings.getCommonSettings(JetLanguage.INSTANCE)!!
|
val jetCommonSettings = settings.getCommonSettings(JetLanguage.INSTANCE)!!
|
||||||
|
|
||||||
return rules(settings) {
|
return rules(settings) {
|
||||||
|
custom {
|
||||||
|
val emptyLineIfLeftMultiline = { (parent: ASTBlock, left: ASTBlock, right: ASTBlock) ->
|
||||||
|
val multilineLF = 2
|
||||||
|
val singleLineLF = 1
|
||||||
|
|
||||||
|
val dependentSpacingRule = DependentSpacingRule(Trigger.HAS_LINE_FEEDS).registerData(Anchor.MIN_LINE_FEEDS, multilineLF)
|
||||||
|
LineFeedDependantSpacing(
|
||||||
|
0, 0,
|
||||||
|
minimumLineFeeds = singleLineLF,
|
||||||
|
keepLineBreaks = settings.KEEP_LINE_BREAKS,
|
||||||
|
keepBlankLines = settings.KEEP_BLANK_LINES_IN_DECLARATIONS,
|
||||||
|
dependency = left.getTextRange(), rule = dependentSpacingRule)
|
||||||
|
}
|
||||||
|
|
||||||
|
inPosition(left = CLASS, right = CLASS).customRule(emptyLineIfLeftMultiline)
|
||||||
|
inPosition(left = FUN, right = FUN).customRule(emptyLineIfLeftMultiline)
|
||||||
|
inPosition(left = PROPERTY, right = FUN).customRule(emptyLineIfLeftMultiline)
|
||||||
|
inPosition(left = FUN, right = PROPERTY).customRule(emptyLineIfLeftMultiline)
|
||||||
|
|
||||||
|
// Case left for alternative constructors
|
||||||
|
inPosition(left = FUN, right = CLASS).customRule(emptyLineIfLeftMultiline)
|
||||||
|
}
|
||||||
|
|
||||||
simple {
|
simple {
|
||||||
// ============ Line breaks ==============
|
// ============ Line breaks ==============
|
||||||
after(PACKAGE_DIRECTIVE).blankLines(1)
|
after(PACKAGE_DIRECTIVE).blankLines(1)
|
||||||
@@ -51,10 +80,15 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
|
|||||||
after(IMPORT_LIST).blankLines(1)
|
after(IMPORT_LIST).blankLines(1)
|
||||||
|
|
||||||
before(DOC_COMMENT).lineBreakInCode()
|
before(DOC_COMMENT).lineBreakInCode()
|
||||||
|
between(PROPERTY, PROPERTY).lineBreakInCode()
|
||||||
|
|
||||||
|
between(CLASS, FUN).blankLines(1)
|
||||||
|
between(CLASS, PROPERTY).blankLines(1)
|
||||||
|
between(PROPERTY, CLASS).blankLines(1)
|
||||||
|
|
||||||
before(FUN).lineBreakInCode()
|
before(FUN).lineBreakInCode()
|
||||||
before(PROPERTY).lineBreakInCode()
|
before(PROPERTY).lineBreakInCode()
|
||||||
between(FUN, FUN).blankLines(1)
|
|
||||||
between(FUN, PROPERTY).blankLines(1)
|
|
||||||
|
|
||||||
// =============== Spacing ================
|
// =============== Spacing ================
|
||||||
betweenInside(LBRACE, RBRACE, CLASS_BODY).spaces(0)
|
betweenInside(LBRACE, RBRACE, CLASS_BODY).spaces(0)
|
||||||
@@ -269,3 +303,17 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LineFeedDependantSpacing(
|
||||||
|
minSpaces: Int,
|
||||||
|
maxSpaces: Int,
|
||||||
|
val minimumLineFeeds: Int,
|
||||||
|
keepLineBreaks: Boolean,
|
||||||
|
keepBlankLines: Int,
|
||||||
|
dependency: TextRange,
|
||||||
|
rule: DependentSpacingRule) : DependantSpacingImpl(minSpaces, maxSpaces, dependency, keepLineBreaks, keepBlankLines, rule) {
|
||||||
|
override fun getMinLineFeeds(): Int {
|
||||||
|
val superMin = super.getMinLineFeeds()
|
||||||
|
return if (superMin == 0) minimumLineFeeds else superMin
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,15 +8,19 @@ class C : Base<String, C, Unit>() {
|
|||||||
override fun bar(value: () -> Unit): (String) -> Unit {
|
override fun bar(value: () -> Unit): (String) -> Unit {
|
||||||
<selection><caret>return super<Base>.bar(value)</selection>
|
<selection><caret>return super<Base>.bar(value)</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return super<Base>.equals(other)
|
return super<Base>.equals(other)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun foo(value: C): C {
|
override fun foo(value: C): C {
|
||||||
return super<Base>.foo(value)
|
return super<Base>.foo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<Base>.hashCode()
|
return super<Base>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val method: (String?) -> String = ?
|
override val method: (String?) -> String = ?
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<Base>.toString()
|
return super<Base>.toString()
|
||||||
|
|||||||
@@ -7,15 +7,19 @@ class C(t :T) : T by t {
|
|||||||
override fun bar() {
|
override fun bar() {
|
||||||
<selection><caret>throw UnsupportedOperationException()</selection>
|
<selection><caret>throw UnsupportedOperationException()</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return super<T>.equals(other)
|
return super<T>.equals(other)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun foo() {
|
override fun foo() {
|
||||||
throw UnsupportedOperationException()
|
throw UnsupportedOperationException()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<T>.hashCode()
|
return super<T>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<T>.toString()
|
return super<T>.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ class SomeOther<S> : Some<S> {
|
|||||||
override fun someFoo() {
|
override fun someFoo() {
|
||||||
<selection><caret>throw UnsupportedOperationException()</selection>
|
<selection><caret>throw UnsupportedOperationException()</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun someGenericFoo(): S {
|
override fun someGenericFoo(): S {
|
||||||
throw UnsupportedOperationException()
|
throw UnsupportedOperationException()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun someOtherFoo(): Int {
|
override fun someOtherFoo(): Int {
|
||||||
throw UnsupportedOperationException()
|
throw UnsupportedOperationException()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,20 +14,25 @@ class C : A(), B {
|
|||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
<selection><caret>return super<A>.equals(other)</selection>
|
<selection><caret>return super<A>.equals(other)</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<A>.hashCode()
|
return super<A>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun internalFun() {
|
override fun internalFun() {
|
||||||
super<A>.internalFun()
|
super<A>.internalFun()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val internalProperty: Int = 0
|
override val internalProperty: Int = 0
|
||||||
override fun protectedFun() {
|
override fun protectedFun() {
|
||||||
super<A>.protectedFun()
|
super<A>.protectedFun()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val protectedProperty: Int = 0
|
override val protectedProperty: Int = 0
|
||||||
override fun publicFun() {
|
override fun publicFun() {
|
||||||
super<A>.publicFun()
|
super<A>.publicFun()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val publicProperty: Int = 0
|
override val publicProperty: Int = 0
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<A>.toString()
|
return super<A>.toString()
|
||||||
|
|||||||
@@ -7,15 +7,19 @@ class C : A {
|
|||||||
override fun bar(): String {
|
override fun bar(): String {
|
||||||
<selection><caret>return super<A>.bar()</selection>
|
<selection><caret>return super<A>.bar()</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return super<A>.equals(other)
|
return super<A>.equals(other)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun foo(value: String): Int {
|
override fun foo(value: String): Int {
|
||||||
return super<A>.foo(value)
|
return super<A>.foo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<A>.hashCode()
|
return super<A>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<A>.toString()
|
return super<A>.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,20 @@ class Other {
|
|||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
<selection><caret>return super<Any>.equals(other)</selection>
|
<selection><caret>return super<Any>.equals(other)</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<Any>.hashCode()
|
return super<Any>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<Any>.toString()
|
return super<Any>.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a = 1
|
val a = 1
|
||||||
}
|
}
|
||||||
fun otherTest() {
|
fun otherTest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,21 @@ class Other {
|
|||||||
fun test() {
|
fun test() {
|
||||||
val a = 1
|
val a = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
<selection><caret>return super<Any>.equals(other)</selection>
|
<selection><caret>return super<Any>.equals(other)</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<Any>.hashCode()
|
return super<Any>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<Any>.toString()
|
return super<Any>.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun otherTest() {
|
fun otherTest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,20 @@ class Other {
|
|||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
<selection><caret>return super<Any>.equals(other)</selection>
|
<selection><caret>return super<Any>.equals(other)</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<Any>.hashCode()
|
return super<Any>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<Any>.toString()
|
return super<Any>.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a = 1
|
val a = 1
|
||||||
}
|
}
|
||||||
fun otherTest() {
|
fun otherTest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ class C : A() {
|
|||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return super<A>.equals(other)
|
return super<A>.equals(other)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun foo(value: Int) {
|
override fun foo(value: Int) {
|
||||||
super<A>.foo(value)
|
super<A>.foo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super<A>.hashCode()
|
return super<A>.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super<A>.toString()
|
return super<A>.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class SomeTest : Test {
|
|||||||
override fun test() {
|
override fun test() {
|
||||||
<selection><caret>throw UnsupportedOperationException()</selection>
|
<selection><caret>throw UnsupportedOperationException()</selection>
|
||||||
}
|
}
|
||||||
|
|
||||||
override val testProp: Int = 0
|
override val testProp: Int = 0
|
||||||
/**
|
/**
|
||||||
* test
|
* test
|
||||||
|
|||||||
+1
@@ -2,6 +2,7 @@ fun foo() {
|
|||||||
class A {
|
class A {
|
||||||
fun test() {}
|
fun test() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
val d: A
|
val d: A
|
||||||
if (<caret>) {
|
if (<caret>) {
|
||||||
d = A()
|
d = A()
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
trait Some {
|
||||||
|
fun f1()
|
||||||
|
fun f2()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class Abstract() {
|
||||||
|
abstract fun f1()
|
||||||
|
abstract fun f2()
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
trait Some {
|
||||||
|
fun f1()
|
||||||
|
fun f2()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class Abstract() {
|
||||||
|
abstract fun f1()
|
||||||
|
abstract fun f2()
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
fun f1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
class C1 {}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
fun f2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
class C2
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
fun f3 = 1
|
||||||
|
class C3 {}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
fun f4 = 2
|
||||||
|
class C4
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C5 {}
|
||||||
|
|
||||||
|
fun f5() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C6
|
||||||
|
|
||||||
|
fun f6() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C7 {}
|
||||||
|
|
||||||
|
fun f7 = 1
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C8
|
||||||
|
|
||||||
|
fun f8 = 1
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
fun f1() {}
|
||||||
|
class C1 {}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
fun f2() {}
|
||||||
|
class C2
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
fun f3 = 1
|
||||||
|
class C3 {}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
fun f4 = 2
|
||||||
|
class C4
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C5 {}
|
||||||
|
fun f5() {}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C6
|
||||||
|
fun f6() {}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C7 {}
|
||||||
|
fun f7 = 1
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
class C8
|
||||||
|
fun f8 = 1
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
class A
|
||||||
|
class B
|
||||||
|
class C {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class D {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class E
|
||||||
|
: Some
|
||||||
|
|
||||||
|
class F
|
||||||
|
|
||||||
|
fun some() = 1
|
||||||
|
class G
|
||||||
|
|
||||||
|
fun some() = 1
|
||||||
|
|
||||||
|
val a = 1
|
||||||
|
|
||||||
|
class H
|
||||||
|
|
||||||
|
val b = 1
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
class A
|
||||||
|
class B
|
||||||
|
class C {
|
||||||
|
|
||||||
|
}
|
||||||
|
class D {
|
||||||
|
|
||||||
|
}
|
||||||
|
class E
|
||||||
|
: Some
|
||||||
|
class F
|
||||||
|
|
||||||
|
fun some() = 1
|
||||||
|
class G
|
||||||
|
fun some() = 1
|
||||||
|
|
||||||
|
val a = 1
|
||||||
|
class H
|
||||||
|
val b = 1
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
// No lines
|
||||||
|
fun f1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
val p1 = 1
|
||||||
|
fun f2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
val p2 = 1
|
||||||
|
fun f4() = 1
|
||||||
|
|
||||||
|
fun f4() {
|
||||||
|
}
|
||||||
|
|
||||||
|
val p3: Int
|
||||||
|
get() = 1
|
||||||
|
|
||||||
|
fun f5() = 1
|
||||||
|
|
||||||
|
class OneLine {
|
||||||
|
fun f1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
val p1 = 1
|
||||||
|
|
||||||
|
fun f2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
fun f4() = 1
|
||||||
|
|
||||||
|
fun f4() {
|
||||||
|
}
|
||||||
|
|
||||||
|
val p3: Int
|
||||||
|
get() = 1
|
||||||
|
|
||||||
|
fun f5() = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
class TwoLines {
|
||||||
|
fun f1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val p1 = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f4() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f4() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val p3: Int
|
||||||
|
get() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f5() = 1
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
// No lines
|
||||||
|
fun f1() {}
|
||||||
|
val p1 = 1
|
||||||
|
fun f2() {}
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
val p2 = 1
|
||||||
|
fun f4() = 1
|
||||||
|
|
||||||
|
fun f4() {}
|
||||||
|
val p3: Int
|
||||||
|
get() = 1
|
||||||
|
fun f5() = 1
|
||||||
|
|
||||||
|
class OneLine {
|
||||||
|
fun f1() {}
|
||||||
|
|
||||||
|
val p1 = 1
|
||||||
|
|
||||||
|
fun f2() {}
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
fun f4() = 1
|
||||||
|
|
||||||
|
fun f4() {}
|
||||||
|
|
||||||
|
val p3: Int
|
||||||
|
get() = 1
|
||||||
|
|
||||||
|
fun f5() = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
class TwoLines {
|
||||||
|
fun f1() {}
|
||||||
|
|
||||||
|
|
||||||
|
val p1 = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f2() {}
|
||||||
|
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f4() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f4() {}
|
||||||
|
|
||||||
|
|
||||||
|
val p3: Int
|
||||||
|
get() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun f5() = 1
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// No lines between
|
||||||
|
|
||||||
|
fun f2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
fun f4() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f5() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f6() = 1
|
||||||
|
fun f7() = 8
|
||||||
|
|
||||||
|
// One line
|
||||||
|
|
||||||
|
fun f2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
|
||||||
|
fun f4() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f5() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f6() = 1
|
||||||
|
|
||||||
|
fun f7() = 8
|
||||||
|
|
||||||
|
// Two lines between
|
||||||
|
fun l1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun l2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun l3() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun l4() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun l5() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun l6() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun l7() = 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
// No lines between
|
||||||
|
|
||||||
|
fun f2() {}
|
||||||
|
fun f1() {}
|
||||||
|
fun f3() = 1
|
||||||
|
fun f4() {}
|
||||||
|
fun f5() {
|
||||||
|
}
|
||||||
|
fun f6() = 1
|
||||||
|
fun f7() = 8
|
||||||
|
|
||||||
|
// One line
|
||||||
|
|
||||||
|
fun f2() {}
|
||||||
|
|
||||||
|
fun f1() {}
|
||||||
|
|
||||||
|
fun f3() = 1
|
||||||
|
|
||||||
|
fun f4() {}
|
||||||
|
|
||||||
|
fun f5() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f6() = 1
|
||||||
|
|
||||||
|
fun f7() = 8
|
||||||
|
|
||||||
|
// Two lines between
|
||||||
|
fun l1() {}
|
||||||
|
|
||||||
|
|
||||||
|
fun l2() {}
|
||||||
|
|
||||||
|
|
||||||
|
fun l3() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun l4() {}
|
||||||
|
|
||||||
|
|
||||||
|
fun l5() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun l6() = 1
|
||||||
|
|
||||||
|
|
||||||
|
fun l7() = 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
val p1 by Some
|
||||||
|
val p2 = 1
|
||||||
|
val p3: Int get() = 3
|
||||||
|
val p4: Int
|
||||||
|
get() {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
val p5: Int
|
||||||
|
|
||||||
|
class OneLine {
|
||||||
|
val p1 by Some
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
val p3: Int get() = 3
|
||||||
|
|
||||||
|
val p4: Int
|
||||||
|
get() {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
val p5: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
class TwoLines {
|
||||||
|
val p1 by Some
|
||||||
|
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
|
||||||
|
val p3: Int get() = 3
|
||||||
|
|
||||||
|
|
||||||
|
val p4: Int
|
||||||
|
get() {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val p5: Int
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
val p1 by Some
|
||||||
|
val p2 = 1
|
||||||
|
val p3: Int get() = 3
|
||||||
|
val p4: Int
|
||||||
|
get() { return 1 }
|
||||||
|
val p5: Int
|
||||||
|
|
||||||
|
class OneLine {
|
||||||
|
val p1 by Some
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
val p3: Int get() = 3
|
||||||
|
|
||||||
|
val p4: Int
|
||||||
|
get() { return 1 }
|
||||||
|
|
||||||
|
val p5: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
class TwoLines {
|
||||||
|
val p1 by Some
|
||||||
|
|
||||||
|
|
||||||
|
val p2 = 1
|
||||||
|
|
||||||
|
|
||||||
|
val p3: Int get() = 3
|
||||||
|
|
||||||
|
|
||||||
|
val p4: Int
|
||||||
|
get() { return 1 }
|
||||||
|
|
||||||
|
|
||||||
|
val p5: Int
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ class Foo<T> {
|
|||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||||
val z: Iterable<T> = y["", w]
|
val z: Iterable<T> = y["", w]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ class Foo<T> {
|
|||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||||
val z = y["", w]
|
val z = y["", w]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class A<T>(val n: T) {
|
|||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B<T>(val m: T)
|
class B<T>(val m: T)
|
||||||
|
|
||||||
fun test(): B<String> {
|
fun test(): B<String> {
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@ class A<T>(val n: T) {
|
|||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B<T>(val m: T)
|
class B<T>(val m: T)
|
||||||
|
|
||||||
fun test<U, V>(u: U): B<V> {
|
fun test<U, V>(u: U): B<V> {
|
||||||
|
|||||||
+1
@@ -4,6 +4,7 @@ class Foo<T> {
|
|||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
for (i: Int in Foo<Int>()) { }
|
for (i: Int in Foo<Int>()) { }
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -4,6 +4,7 @@ class Foo<T> {
|
|||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
for (i in Foo<Int>()) {
|
for (i in Foo<Int>()) {
|
||||||
bar(i)
|
bar(i)
|
||||||
|
|||||||
@@ -156,6 +156,42 @@ public class JetFormatterTestGenerated extends AbstractJetFormatterTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("EmptyLineBetweeAbstractFunctions.after.kt")
|
||||||
|
public void testEmptyLineBetweeAbstractFunctions() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/EmptyLineBetweeAbstractFunctions.after.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("EmptyLineBetweenClassAndFunction.after.kt")
|
||||||
|
public void testEmptyLineBetweenClassAndFunction() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/EmptyLineBetweenClassAndFunction.after.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("EmptyLineBetweenClasses.after.kt")
|
||||||
|
public void testEmptyLineBetweenClasses() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/EmptyLineBetweenClasses.after.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("EmptyLineBetweenFunAndProperty.after.kt")
|
||||||
|
public void testEmptyLineBetweenFunAndProperty() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/EmptyLineBetweenFunAndProperty.after.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("EmptyLineBetweenFunctions.after.kt")
|
||||||
|
public void testEmptyLineBetweenFunctions() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/EmptyLineBetweenFunctions.after.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("EmptyLineBetweenProperties.after.kt")
|
||||||
|
public void testEmptyLineBetweenProperties() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/EmptyLineBetweenProperties.after.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ForLineBreak.after.kt")
|
@TestMetadata("ForLineBreak.after.kt")
|
||||||
public void testForLineBreak() throws Exception {
|
public void testForLineBreak() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/ForLineBreak.after.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/ForLineBreak.after.kt");
|
||||||
|
|||||||
@@ -938,10 +938,12 @@ class SmartEnterTest : JetLightCodeInsightFixtureTestCase() {
|
|||||||
fun testFunBody7() = doFileTest(
|
fun testFunBody7() = doFileTest(
|
||||||
"""
|
"""
|
||||||
trait T
|
trait T
|
||||||
|
|
||||||
fun <U> other() where U: T<caret>
|
fun <U> other() where U: T<caret>
|
||||||
""",
|
""",
|
||||||
"""
|
"""
|
||||||
trait T
|
trait T
|
||||||
|
|
||||||
fun <U> other() where U : T {
|
fun <U> other() where U : T {
|
||||||
<caret>
|
<caret>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ abstract class Shape {
|
|||||||
public fun setColor(c: String) {
|
public fun setColor(c: String) {
|
||||||
color = c
|
color = c
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getColor(): String {
|
public fun getColor(): String {
|
||||||
return color
|
return color
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract fun area(): Double
|
public abstract fun area(): Double
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
class T {
|
class T {
|
||||||
fun main() {
|
fun main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun i(): Int {
|
fun i(): Int {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun s(): String {
|
fun s(): String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import java.util.HashMap
|
|||||||
fun Test(): Test {
|
fun Test(): Test {
|
||||||
return Test()
|
return Test()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Test(s: String): Test {
|
fun Test(s: String): Test {
|
||||||
return Test()
|
return Test()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class S {
|
|||||||
fun sB(): Boolean {
|
fun sB(): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sI(): Int {
|
fun sI(): Int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class Customer(public val _firstName: String, public val _lastName: String) {
|
|||||||
|
|
||||||
private fun doSmthBefore() {
|
private fun doSmthBefore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doSmthAfter() {
|
private fun doSmthAfter() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class C(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
|
|||||||
fun foo(p: Int): Int {
|
fun foo(p: Int): Int {
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun staticFoo(p: Int): Int {
|
private fun staticFoo(p: Int): Int {
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class F {
|
|||||||
|
|
||||||
fun f2() {
|
fun f2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var i: Int? = 0
|
var i: Int? = 0
|
||||||
|
|
||||||
fun f3() {
|
fun f3() {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class F {
|
|||||||
|
|
||||||
fun f2() {
|
fun f2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var i: Int? = 0
|
var i: Int? = 0
|
||||||
|
|
||||||
fun f3() {
|
fun f3() {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class F {
|
|||||||
|
|
||||||
fun f1() {
|
fun f1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var i: Int? = 0
|
var i: Int? = 0
|
||||||
|
|
||||||
//c5
|
//c5
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class F {
|
|||||||
|
|
||||||
fun f2() {
|
fun f2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var i: Int? = 0
|
var i: Int? = 0
|
||||||
|
|
||||||
fun f3() {
|
fun f3() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class A {
|
|||||||
fun a() {
|
fun a() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B : A() {
|
class B : A() {
|
||||||
override fun a() {
|
override fun a() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class Java {
|
|||||||
val m = HashMap()
|
val m = HashMap()
|
||||||
m.put(1, 1)
|
m.put(1, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2() {
|
fun test2() {
|
||||||
val m = HashMap()
|
val m = HashMap()
|
||||||
val g = G("")
|
val g = G("")
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class StringContainer(s: String)
|
|||||||
class Test {
|
class Test {
|
||||||
fun putString(s: String) {
|
fun putString(s: String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
putString(One.myContainer.myString)
|
putString(One.myContainer.myString)
|
||||||
StringContainer(One.myContainer.myString)
|
StringContainer(One.myContainer.myString)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class IntContainer(i: Int)
|
|||||||
class Test {
|
class Test {
|
||||||
fun putInt(i: Int) {
|
fun putInt(i: Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
putInt(One.myContainer.myInt)
|
putInt(One.myContainer.myInt)
|
||||||
IntContainer(One.myContainer.myInt)
|
IntContainer(One.myContainer.myInt)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class Language(protected var code: String) : Serializable {
|
|||||||
class Base {
|
class Base {
|
||||||
fun test() {
|
fun test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "BASE"
|
return "BASE"
|
||||||
}
|
}
|
||||||
@@ -21,6 +22,7 @@ class Base {
|
|||||||
class Child : Base() {
|
class Child : Base() {
|
||||||
override fun test() {
|
override fun test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Child"
|
return "Child"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
open class A {
|
open class A {
|
||||||
open fun foo1() {
|
open fun foo1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun foo2() {
|
private fun foo2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo3() {
|
fun foo3() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,4 +33,4 @@ enum class E {
|
|||||||
fun foo(): Int {
|
fun foo(): Int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class A {
|
|||||||
|
|
||||||
private fun privateStatic1() {
|
private fun privateStatic1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun privateStatic2() {
|
private fun privateStatic2() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class A {
|
|||||||
|
|
||||||
private fun privateStatic1() {
|
private fun privateStatic1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun privateStatic2() {
|
private fun privateStatic2() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ class A {
|
|||||||
|
|
||||||
private fun privateStatic1() {
|
private fun privateStatic1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun privateStatic2() {
|
private fun privateStatic2() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class A {
|
|||||||
|
|
||||||
private fun privateStatic1() {
|
private fun privateStatic1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun privateStatic2() {
|
private fun privateStatic2() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class A {
|
|||||||
|
|
||||||
private fun privateStatic1() {
|
private fun privateStatic1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun privateStatic2() {
|
private fun privateStatic2() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user