Revert "RemoveBracesIntention: add new line for long expression"
This reverts commit f4b9c477
This commit is contained in:
@@ -62,13 +62,6 @@ class RemoveBracesIntention : SelfTargetingIntention<KtElement>(KtElement::class
|
|||||||
|
|
||||||
if (construct is KtDoWhileExpression) {
|
if (construct is KtDoWhileExpression) {
|
||||||
newElement.parent!!.addAfter(factory.createNewLine(), newElement)
|
newElement.parent!!.addAfter(factory.createNewLine(), newElement)
|
||||||
} else if (editor != null) {
|
|
||||||
val document = editor.document
|
|
||||||
val line = document.getLineNumber(newElement.startOffset)
|
|
||||||
val rightMargin = editor.settings.getRightMargin(editor.project)
|
|
||||||
if (document.getLineEndOffset(line) - document.getLineStartOffset(line) >= rightMargin) {
|
|
||||||
newElement.parent.addBefore(factory.createNewLine(), newElement)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (construct is KtIfExpression &&
|
if (construct is KtIfExpression &&
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
fun foo(
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: Boolean
|
|
||||||
): Int {
|
|
||||||
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {<caret>
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fun foo(
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: Boolean
|
|
||||||
): Int {
|
|
||||||
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
|
|
||||||
return 1
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
fun foo(
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: Boolean
|
|
||||||
): Int {
|
|
||||||
when {
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -> {<caret>
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
else -> return 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
fun foo(
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: Boolean
|
|
||||||
): Int {
|
|
||||||
when {
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ->
|
|
||||||
return 1
|
|
||||||
else -> return 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13781,11 +13781,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
runTest("idea/testData/intentions/removeBraces/ifLambda2.kt");
|
runTest("idea/testData/intentions/removeBraces/ifLambda2.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ifLong.kt")
|
|
||||||
public void testIfLong() throws Exception {
|
|
||||||
runTest("idea/testData/intentions/removeBraces/ifLong.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ifWithComment.kt")
|
@TestMetadata("ifWithComment.kt")
|
||||||
public void testIfWithComment() throws Exception {
|
public void testIfWithComment() throws Exception {
|
||||||
runTest("idea/testData/intentions/removeBraces/ifWithComment.kt");
|
runTest("idea/testData/intentions/removeBraces/ifWithComment.kt");
|
||||||
@@ -13831,11 +13826,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
runTest("idea/testData/intentions/removeBraces/whenLambda3.kt");
|
runTest("idea/testData/intentions/removeBraces/whenLambda3.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("whenLong.kt")
|
|
||||||
public void testWhenLong() throws Exception {
|
|
||||||
runTest("idea/testData/intentions/removeBraces/whenLong.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("whenMultiple.kt")
|
@TestMetadata("whenMultiple.kt")
|
||||||
public void testWhenMultiple() throws Exception {
|
public void testWhenMultiple() throws Exception {
|
||||||
runTest("idea/testData/intentions/removeBraces/whenMultiple.kt");
|
runTest("idea/testData/intentions/removeBraces/whenMultiple.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user