Reformat code should not align comments (KT-4175)

#KT-4175 In Progress
This commit is contained in:
Nikolay Krasko
2016-03-09 16:21:05 +03:00
parent 334c6ba71a
commit 6193987d0d
19 changed files with 278 additions and 13 deletions
+1 -2
View File
@@ -12,8 +12,7 @@ class A {
}
}
fun foo() {
// abc
fun foo() { // abc
class B
}
@@ -0,0 +1,46 @@
package format.test
class LineComments {
fun test() {
// Should not be formatted
// Format
// Format
// Normal
}
}
class KDocComments {
/**
* Always ident for KDocs
*/
/**
* Format
*/
fun test() {
/**
* Always ident for KDocs
*/
/**
* Format
*/
/**
* Normal
*/
}
}
class MultilineComments {
fun test() {
/*
* Should not be formatted
*/
/*
* Format
*/
/*
* Normal
*/
}
}
// SET_TRUE: KEEP_FIRST_COLUMN_COMMENT
@@ -0,0 +1,46 @@
package format.test
class LineComments {
fun test() {
// Should not be formatted
// Format
// Format
// Normal
}
}
class KDocComments {
/**
* Always ident for KDocs
*/
/**
* Format
*/
fun test() {
/**
* Always ident for KDocs
*/
/**
* Format
*/
/**
* Normal
*/
}
}
class MultilineComments {
fun test() {
/*
* Should not be formatted
*/
/*
* Format
*/
/*
* Normal
*/
}
}
// SET_TRUE: KEEP_FIRST_COLUMN_COMMENT
+46
View File
@@ -0,0 +1,46 @@
package format.test
class LineComments {
fun test() {
// Should not be formatted
// Format
// Format
// Normal
}
}
class KDocComments {
/**
* Always ident for KDocs
*/
/**
* Format
*/
fun test() {
/**
* Always ident for KDocs
*/
/**
* Format
*/
/**
* Normal
*/
}
}
class MultilineComments {
fun test() {
/*
* Should not be formatted
*/
/*
* Format
*/
/*
* Normal
*/
}
}
// SET_TRUE: KEEP_FIRST_COLUMN_COMMENT
@@ -0,0 +1,24 @@
package format.test
// TODO: Comment on first column shouldn't be formatted, but now there's no way to adjust rule for the first comment in parent declaration.
class LineComments {
// Should not be formatted
// Format
// Format
fun test() {
}
}
class MultilineComments {
/*
* Should not be formatted
*/
/*
* Format
*/
fun test() {
}
}
// SET_TRUE: KEEP_FIRST_COLUMN_COMMENT
@@ -0,0 +1,24 @@
package format.test
// TODO: Comment on first column shouldn't be formatted, but now there's no way to adjust rule for the first comment in parent declaration.
class LineComments {
// Should not be formatted
// Format
// Format
fun test() {
}
}
class MultilineComments {
/*
* Should not be formatted
*/
/*
* Format
*/
fun test() {
}
}
// SET_TRUE: KEEP_FIRST_COLUMN_COMMENT
@@ -0,0 +1,24 @@
package format.test
// TODO: Comment on first column shouldn't be formatted, but now there's no way to adjust rule for the first comment in parent declaration.
class LineComments {
// Should not be formatted
// Format
// Format
fun test() {
}
}
class MultilineComments {
/*
* Should not be formatted
*/
/*
* Format
*/
fun test() {
}
}
// SET_TRUE: KEEP_FIRST_COLUMN_COMMENT
@@ -35,9 +35,9 @@ fun test3() {
fun testWithComments() {
val abc = ArrayList<Int>()
// .map {
// it * 2
// }
// .map {
// it * 2
// }
.filter {
it > 4
}
@@ -17,7 +17,6 @@ fun main(args: Array<String>)
/*2*/
/*3*/
{
}
@@ -15,7 +15,6 @@ fun main(args: Array<String>) {
/*2*/
/*3*/ {
}
+1 -2
View File
@@ -12,8 +12,7 @@ class A {
}
}
fun foo() {
// abc
fun foo() { // abc
object B
}
+1 -2
View File
@@ -47,8 +47,7 @@ public var varWithAccessors1: Int
get() {
return 1
}
set (value: Int) {
/**/
set (value: Int) { /**/
}
public var varWithAccessors2: Int