Add space between 'when' and '('
This commit is contained in:
@@ -113,6 +113,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
|
|||||||
betweenInside(IF_KEYWORD, LPAR, IF).spacing(1, 1, 0, false, 0)
|
betweenInside(IF_KEYWORD, LPAR, IF).spacing(1, 1, 0, false, 0)
|
||||||
betweenInside(WHILE_KEYWORD, LPAR, WHILE).spacing(1, 1, 0, false, 0)
|
betweenInside(WHILE_KEYWORD, LPAR, WHILE).spacing(1, 1, 0, false, 0)
|
||||||
betweenInside(WHILE_KEYWORD, LPAR, DO_WHILE).spacing(1, 1, 0, false, 0)
|
betweenInside(WHILE_KEYWORD, LPAR, DO_WHILE).spacing(1, 1, 0, false, 0)
|
||||||
|
betweenInside(WHEN_KEYWORD, LPAR, WHEN).spacing(1, 1, 0, false, 0)
|
||||||
|
|
||||||
val TYPE_COLON_ELEMENTS = TokenSet.create(PROPERTY, FUN, VALUE_PARAMETER, MULTI_VARIABLE_DECLARATION_ENTRY, FUNCTION_LITERAL)
|
val TYPE_COLON_ELEMENTS = TokenSet.create(PROPERTY, FUN, VALUE_PARAMETER, MULTI_VARIABLE_DECLARATION_ENTRY, FUNCTION_LITERAL)
|
||||||
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(jetSettings.SPACE_BEFORE_TYPE_COLON) }
|
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(jetSettings.SPACE_BEFORE_TYPE_COLON) }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ enum class MyEnum {
|
|||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val a = MyEnum.FIRST
|
val a = MyEnum.FIRST
|
||||||
when(a) {
|
when (a) {
|
||||||
<caret> -> {
|
<caret> -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
val a = "aa"
|
val a = "aa"
|
||||||
when(a.capitalize()) {
|
when (a.capitalize()) {
|
||||||
<caret> -> {
|
<caret> -> {
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
val a = "aa"
|
val a = "aa"
|
||||||
when(a) {
|
when (a) {
|
||||||
<caret> -> {
|
<caret> -> {
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
@@ -3,6 +3,31 @@ fun some(x: Any) {
|
|||||||
is Number -> 0
|
is Number -> 0
|
||||||
else -> 1
|
else -> 1
|
||||||
}
|
}
|
||||||
|
when {
|
||||||
|
}
|
||||||
|
|
||||||
|
when {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
when {
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH
|
// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH
|
||||||
@@ -3,6 +3,31 @@ fun some(x: Any) {
|
|||||||
is Number -> 0
|
is Number -> 0
|
||||||
else -> 1
|
else -> 1
|
||||||
}
|
}
|
||||||
|
when {
|
||||||
|
}
|
||||||
|
|
||||||
|
when {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
when {
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH
|
// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH
|
||||||
@@ -3,6 +3,42 @@ when (x) {
|
|||||||
is Number -> 0
|
is Number -> 0
|
||||||
else->1
|
else->1
|
||||||
}
|
}
|
||||||
|
when {
|
||||||
|
}
|
||||||
|
|
||||||
|
when{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
when
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
when (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when(true){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when
|
||||||
|
(true)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(true)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH
|
// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fun f() {
|
fun f() {
|
||||||
when(c) {
|
when (c) {
|
||||||
a -> {
|
a -> {
|
||||||
}
|
}
|
||||||
b -> j
|
b -> j
|
||||||
@@ -7,7 +7,7 @@ fun f() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c) {
|
when (c) {
|
||||||
a -> {
|
a -> {
|
||||||
}
|
}
|
||||||
b -> j
|
b -> j
|
||||||
@@ -15,7 +15,7 @@ fun f() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c) {
|
when (c) {
|
||||||
a -> {
|
a -> {
|
||||||
}
|
}
|
||||||
b -> j
|
b -> j
|
||||||
@@ -23,7 +23,7 @@ fun f() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c) //eol comment
|
when (c) //eol comment
|
||||||
{
|
{
|
||||||
a -> //eol comment
|
a -> //eol comment
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun f()
|
fun f()
|
||||||
{
|
{
|
||||||
when(c)
|
when (c)
|
||||||
{
|
{
|
||||||
a ->
|
a ->
|
||||||
{
|
{
|
||||||
@@ -11,7 +11,7 @@ fun f()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c)
|
when (c)
|
||||||
{
|
{
|
||||||
a ->
|
a ->
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@ fun f()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c)
|
when (c)
|
||||||
{
|
{
|
||||||
a ->
|
a ->
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@ fun f()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c) //eol comment
|
when (c) //eol comment
|
||||||
{
|
{
|
||||||
a -> //eol comment
|
a -> //eol comment
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun f()
|
fun f()
|
||||||
{
|
{
|
||||||
when(c) {
|
when (c) {
|
||||||
a -> {
|
a -> {
|
||||||
}
|
}
|
||||||
b -> j
|
b -> j
|
||||||
@@ -8,7 +8,7 @@ fun f()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c)
|
when (c)
|
||||||
{
|
{
|
||||||
a ->
|
a ->
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@ fun f()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c)
|
when (c)
|
||||||
|
|
||||||
{
|
{
|
||||||
a ->
|
a ->
|
||||||
@@ -33,7 +33,7 @@ fun f()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when(c) //eol comment
|
when (c) //eol comment
|
||||||
{
|
{
|
||||||
a -> //eol comment
|
a -> //eol comment
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ fun test(n: Int): String {
|
|||||||
var res: String
|
var res: String
|
||||||
|
|
||||||
if (3 > 2) {
|
if (3 > 2) {
|
||||||
<caret>when(n) {
|
<caret>when (n) {
|
||||||
1 -> {
|
1 -> {
|
||||||
doSomething("***")
|
doSomething("***")
|
||||||
res = "one"
|
res = "one"
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ fun test(n: Int): String {
|
|||||||
var res: String
|
var res: String
|
||||||
|
|
||||||
if (3 > 2) {
|
if (3 > 2) {
|
||||||
<caret>res = when(n) {
|
<caret>res = when (n) {
|
||||||
1 -> {
|
1 -> {
|
||||||
doSomething("***")
|
doSomething("***")
|
||||||
"one"
|
"one"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
fun test(n: Int): String {
|
fun test(n: Int): String {
|
||||||
var res: String
|
var res: String
|
||||||
|
|
||||||
<caret>when(n) {
|
<caret>when (n) {
|
||||||
1 -> res = "one"
|
1 -> res = "one"
|
||||||
else -> res = "two"
|
else -> res = "two"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
fun test(n: Int): String {
|
fun test(n: Int): String {
|
||||||
var res: String
|
var res: String
|
||||||
|
|
||||||
<caret>res = when(n) {
|
<caret>res = when (n) {
|
||||||
1 -> "one"
|
1 -> "one"
|
||||||
else -> "two"
|
else -> "two"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
fun doSomething<T>(a: T) {}
|
fun doSomething<T>(a: T) {}
|
||||||
|
|
||||||
fun test(n: Int): String {
|
fun test(n: Int): String {
|
||||||
<caret>when(n) {
|
<caret>when (n) {
|
||||||
1 -> {
|
1 -> {
|
||||||
doSomething("***")
|
doSomething("***")
|
||||||
return "one"
|
return "one"
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
fun doSomething<T>(a: T) {}
|
fun doSomething<T>(a: T) {}
|
||||||
|
|
||||||
fun test(n: Int): String {
|
fun test(n: Int): String {
|
||||||
<caret>return when(n) {
|
<caret>return when (n) {
|
||||||
1 -> {
|
1 -> {
|
||||||
doSomething("***")
|
doSomething("***")
|
||||||
"one"
|
"one"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fun test(n: Int): String? {
|
fun test(n: Int): String? {
|
||||||
val res<caret> = when(n) {
|
val res<caret> = when (n) {
|
||||||
1 -> "one"
|
1 -> "one"
|
||||||
2 -> "two"
|
2 -> "two"
|
||||||
else -> null
|
else -> null
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun test(n: Int): String? {
|
fun test(n: Int): String? {
|
||||||
val res: String?
|
val res: String?
|
||||||
<caret>when(n) {
|
<caret>when (n) {
|
||||||
1 -> res = "one"
|
1 -> res = "one"
|
||||||
2 -> res = "two"
|
2 -> res = "two"
|
||||||
else -> res = null
|
else -> res = null
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fun test(n: Int): String? {
|
fun test(n: Int): String? {
|
||||||
var res<caret> = when(n) {
|
var res<caret> = when (n) {
|
||||||
1 -> "one"
|
1 -> "one"
|
||||||
2 -> "two"
|
2 -> "two"
|
||||||
else -> null
|
else -> null
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun test(n: Int): String? {
|
fun test(n: Int): String? {
|
||||||
var res: String?
|
var res: String?
|
||||||
<caret>when(n) {
|
<caret>when (n) {
|
||||||
1 -> res = "one"
|
1 -> res = "one"
|
||||||
2 -> res = "two"
|
2 -> res = "two"
|
||||||
else -> res = null
|
else -> res = null
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fun test(n: Int): String? {
|
fun test(n: Int): String? {
|
||||||
val res<caret>: String? = when(n) {
|
val res<caret>: String? = when (n) {
|
||||||
1 -> "one"
|
1 -> "one"
|
||||||
2 -> "two"
|
2 -> "two"
|
||||||
else -> null
|
else -> null
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
fun test(n: Int): String? {
|
fun test(n: Int): String? {
|
||||||
val res: String?
|
val res: String?
|
||||||
<caret>when(n) {
|
<caret>when (n) {
|
||||||
1 -> res = "one"
|
1 -> res = "one"
|
||||||
2 -> res = "two"
|
2 -> res = "two"
|
||||||
else -> res = null
|
else -> res = null
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInDirectSettings() throws Exception {
|
public void testAllFilesPresentInDirectSettings() throws Exception {
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage",
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/indentationOnNewline"), Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), true);
|
||||||
new File("idea/testData/indentationOnNewline"),
|
|
||||||
Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ConsecutiveCallsAfterDot.after.kt")
|
@TestMetadata("ConsecutiveCallsAfterDot.after.kt")
|
||||||
|
|||||||
Reference in New Issue
Block a user