TrailingCommaInspection: report Missing trailing comma on argument
#KT-34744
This commit is contained in:
@@ -141,10 +141,9 @@ class TrailingCommaInspection(
|
|||||||
val textRange = textRange
|
val textRange = textRange
|
||||||
if (isComma) return textRange
|
if (isComma) return textRange
|
||||||
|
|
||||||
val resultRange = nextLeaf()?.leafIgnoringWhitespaceAndComments(false)?.endOffset?.takeIf { it > 0 }?.let {
|
return nextLeaf()?.leafIgnoringWhitespaceAndComments(false)?.endOffset?.takeIf { it > 0 }?.let {
|
||||||
TextRange.create(it - 1, it).intersection(parent.textRange)
|
TextRange.create(it - 1, it).intersection(textRange)
|
||||||
} ?: TextRange.create(textRange.endOffset - 1, textRange.endOffset)
|
} ?: TextRange.create(textRange.endOffset - 1, textRange.endOffset)
|
||||||
return resultRange.shiftRight(1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+405
-405
File diff suppressed because it is too large
Load Diff
@@ -2,4 +2,4 @@
|
|||||||
// FIX: Add trailing comma
|
// FIX: Add trailing comma
|
||||||
|
|
||||||
fun a(i: Int,
|
fun a(i: Int,
|
||||||
b: Boolean)<caret> = Unit
|
b: Boolea<caret>n) = Unit
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
// PROBLEM: none
|
// PROBLEM: none
|
||||||
|
|
||||||
fun a(i: Int,
|
fun a(i: Int,
|
||||||
b: Boolea<caret>n) = Unit
|
b: Boole<caret>an) = Unit
|
||||||
@@ -2,4 +2,5 @@
|
|||||||
// PROBLEM: none
|
// PROBLEM: none
|
||||||
|
|
||||||
fun a(i: Int,
|
fun a(i: Int,
|
||||||
b: Boolean) <caret>= Unit
|
b: Boolean <caret>
|
||||||
|
) = Unit
|
||||||
Reference in New Issue
Block a user