diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt index 690dce6399c..1dcdd938f94 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt @@ -153,6 +153,10 @@ fun PsiElement.getPrevSiblingIgnoringWhitespaceAndComments(withItself: Boolean = return siblings(withItself = withItself, forward = false).filter { it !is PsiWhiteSpace && it !is PsiComment }.firstOrNull() } +fun PsiElement.getPrevSiblingIgnoringWhitespace(withItself: Boolean = false): PsiElement? { + return siblings(withItself = withItself, forward = false).filter { it !is PsiWhiteSpace }.firstOrNull() +} + inline fun T.nextSiblingOfSameType() = PsiTreeUtil.getNextSiblingOfType(this, T::class.java) inline fun T.prevSiblingOfSameType() = PsiTreeUtil.getPrevSiblingOfType(this, T::class.java) diff --git a/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/after.kt.template b/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/after.kt.template new file mode 100644 index 00000000000..6460d9e89fb --- /dev/null +++ b/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/after.kt.template @@ -0,0 +1,3 @@ +// comment1 +// comment2 +val foo = 1 diff --git a/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/before.kt.template b/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/before.kt.template new file mode 100644 index 00000000000..f70de82d094 --- /dev/null +++ b/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/before.kt.template @@ -0,0 +1,5 @@ +/* +comment1 +comment2 +*/ +val foo = 1 diff --git a/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/description.html b/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/description.html new file mode 100644 index 00000000000..ee1e33aa5f2 --- /dev/null +++ b/idea/resources/intentionDescriptions/ConvertBlockCommentToLineCommentIntention/description.html @@ -0,0 +1,5 @@ + + +This intention replaces a block comment with one or more end-of-line comments. + + \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/after.kt.template b/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/after.kt.template new file mode 100644 index 00000000000..f70de82d094 --- /dev/null +++ b/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/after.kt.template @@ -0,0 +1,5 @@ +/* +comment1 +comment2 +*/ +val foo = 1 diff --git a/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/before.kt.template b/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/before.kt.template new file mode 100644 index 00000000000..6460d9e89fb --- /dev/null +++ b/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/before.kt.template @@ -0,0 +1,3 @@ +// comment1 +// comment2 +val foo = 1 diff --git a/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/description.html b/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/description.html new file mode 100644 index 00000000000..2fde82a4c79 --- /dev/null +++ b/idea/resources/intentionDescriptions/ConvertLineCommentToBlockCommentIntention/description.html @@ -0,0 +1,5 @@ + + +This intention replaces one or more end-of-line comments with a block comment. + + \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 6b3675727a7..834db15625b 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -1582,6 +1582,16 @@ Kotlin + + org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention + Kotlin + + Kotlin + + org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention + Kotlin + + Kotlin + + org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention + Kotlin + + Kotlin + + org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention + Kotlin + + Kotlin + + org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention + Kotlin + + Kotlin + + org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention + Kotlin + + ( + PsiComment::class.java, "Replace with end of line comment" +) { + override fun isApplicableTo(element: PsiComment, caretOffset: Int): Boolean { + return element.isBlockComment() + } + + override fun applyTo(element: PsiComment, editor: Editor?) { + val psiFactory = KtPsiFactory(element) + + val prevSibling = element.prevSibling + val indent = if (prevSibling is PsiWhiteSpace) { + val space = prevSibling.text.reversed().takeWhile { it == ' ' || it == '\t' } + psiFactory.createWhiteSpace("\n$space") + } else { + psiFactory.createNewLine() + } + + val comments = element.text + .substring(2, element.text.length - 2) + .trim() + .split("\n") + .reversed() + val lastIndex = comments.size - 1 + val parent = element.parent + comments.forEachIndexed { index, comment -> + val commentText = comment.trim().let { if (it.isEmpty()) "//" else "// $it" } + parent.addAfter(psiFactory.createComment(commentText), element) + if (index != lastIndex) parent.addAfter(indent, element) + } + element.delete() + } +} + +private fun PsiElement.isBlockComment() = node.elementType == KtTokens.BLOCK_COMMENT diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertLineCommentToBlockCommentIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertLineCommentToBlockCommentIntention.kt new file mode 100644 index 00000000000..c78ccd74fce --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertLineCommentToBlockCommentIntention.kt @@ -0,0 +1,67 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.intentions + +import com.intellij.openapi.editor.Editor +import com.intellij.psi.PsiComment +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiWhiteSpace +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.KtPsiFactory +import org.jetbrains.kotlin.psi.psiUtil.getNextSiblingIgnoringWhitespace +import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespace + +class ConvertLineCommentToBlockCommentIntention : SelfTargetingIntention( + PsiComment::class.java, "Replace with block comment" +) { + + override fun isApplicableTo(element: PsiComment, caretOffset: Int): Boolean { + return element.isEndOfLineComment() + } + + override fun applyTo(element: PsiComment, editor: Editor?) { + var firstComment = element + while (true) { + firstComment = firstComment.prevComment() ?: break + } + + val indent = (firstComment.prevSibling as? PsiWhiteSpace)?.text?.reversed()?.takeWhile { it == ' ' || it == '\t' } ?: "" + + val comments = mutableListOf(firstComment) + var nextComment = firstComment + while (true) { + nextComment = nextComment.nextComment() ?: break + comments.add(nextComment) + } + + val blockComment = if (comments.size == 1) + "/* ${comments.first().commentText()} */" + else + comments.joinToString(separator = "\n", prefix = "/*\n", postfix = "\n$indent*/") { + "$indent${it.commentText()}" + } + + comments.drop(1).forEach { + (it.prevSibling as? PsiWhiteSpace)?.delete() + it.delete() + } + firstComment.replace(KtPsiFactory(element).createComment(blockComment)) + } + +} + +private fun PsiElement.isEndOfLineComment() = node.elementType == KtTokens.EOL_COMMENT + +private fun PsiComment.commentText() = text.substring(2).replace("/*", "/ *").replace("*/", "* /").trim() + +private fun PsiComment.nextComment(): PsiComment? { + return (getNextSiblingIgnoringWhitespace() as? PsiComment)?.takeIf { it.isEndOfLineComment() } +} + +private fun PsiComment.prevComment(): PsiComment? { + return (getPrevSiblingIgnoringWhitespace() as? PsiComment)?.takeIf { it.isEndOfLineComment() } +} + diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/.intention b/idea/testData/intentions/convertBlockCommentToLineComment/.intention new file mode 100644 index 00000000000..f11183e7b4b --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/.intention @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/afterStatement.kt b/idea/testData/intentions/convertBlockCommentToLineComment/afterStatement.kt new file mode 100644 index 00000000000..7bb6f03d775 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/afterStatement.kt @@ -0,0 +1,3 @@ +fun test() { + val foo = 1 /* comment */ +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/afterStatement.kt.after b/idea/testData/intentions/convertBlockCommentToLineComment/afterStatement.kt.after new file mode 100644 index 00000000000..1bf8a7041a5 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/afterStatement.kt.after @@ -0,0 +1,3 @@ +fun test() { + val foo = 1 // comment +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/beforeStatement.kt b/idea/testData/intentions/convertBlockCommentToLineComment/beforeStatement.kt new file mode 100644 index 00000000000..adfe2a1b057 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/beforeStatement.kt @@ -0,0 +1,3 @@ +fun test() { + /* comment */ val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/beforeStatement.kt.after b/idea/testData/intentions/convertBlockCommentToLineComment/beforeStatement.kt.after new file mode 100644 index 00000000000..f50e77ec41c --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/beforeStatement.kt.after @@ -0,0 +1,4 @@ +fun test() { + // comment + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/blankLine.kt b/idea/testData/intentions/convertBlockCommentToLineComment/blankLine.kt new file mode 100644 index 00000000000..c3354243924 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/blankLine.kt @@ -0,0 +1,11 @@ +fun test() { + /* + + comment1 + + comment2 + + comment3 + */ + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/blankLine.kt.after b/idea/testData/intentions/convertBlockCommentToLineComment/blankLine.kt.after new file mode 100644 index 00000000000..227ff99bfc7 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/blankLine.kt.after @@ -0,0 +1,8 @@ +fun test() { + // comment1 + // + // comment2 + // + // comment3 + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/docComment.kt b/idea/testData/intentions/convertBlockCommentToLineComment/docComment.kt new file mode 100644 index 00000000000..598798bf26b --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/docComment.kt @@ -0,0 +1,7 @@ +// IS_APPLICABLE: false +fun test() { + /** + * comment + */ + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/endOflineComment.kt b/idea/testData/intentions/convertBlockCommentToLineComment/endOflineComment.kt new file mode 100644 index 00000000000..a76d9e24130 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/endOflineComment.kt @@ -0,0 +1,5 @@ +// IS_APPLICABLE: false +fun test() { + // comment + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/newLinesBetweenCommentAndDeclaration.kt b/idea/testData/intentions/convertBlockCommentToLineComment/newLinesBetweenCommentAndDeclaration.kt new file mode 100644 index 00000000000..507b859c1c0 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/newLinesBetweenCommentAndDeclaration.kt @@ -0,0 +1,9 @@ +fun foo() {} + + +/* + comment +*/ + + +fun bar() {} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/newLinesBetweenCommentAndDeclaration.kt.after b/idea/testData/intentions/convertBlockCommentToLineComment/newLinesBetweenCommentAndDeclaration.kt.after new file mode 100644 index 00000000000..b8aa711503e --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/newLinesBetweenCommentAndDeclaration.kt.after @@ -0,0 +1,7 @@ +fun foo() {} + + +// comment + + +fun bar() {} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/simple.kt b/idea/testData/intentions/convertBlockCommentToLineComment/simple.kt new file mode 100644 index 00000000000..69d0a764a29 --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/simple.kt @@ -0,0 +1,7 @@ +fun test() { + /* + comment1 + comment2 + */ + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertBlockCommentToLineComment/simple.kt.after b/idea/testData/intentions/convertBlockCommentToLineComment/simple.kt.after new file mode 100644 index 00000000000..daf9da9dd5b --- /dev/null +++ b/idea/testData/intentions/convertBlockCommentToLineComment/simple.kt.after @@ -0,0 +1,5 @@ +fun test() { + // comment1 + // comment2 + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/.intention b/idea/testData/intentions/convertLineCommentToBlockComment/.intention new file mode 100644 index 00000000000..84b739f3d2e --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/.intention @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/afterStatement.kt b/idea/testData/intentions/convertLineCommentToBlockComment/afterStatement.kt new file mode 100644 index 00000000000..fe8d0cacdec --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/afterStatement.kt @@ -0,0 +1,4 @@ +fun test() { + val foo = 1 // comment1 + // comment2 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/afterStatement.kt.after b/idea/testData/intentions/convertLineCommentToBlockComment/afterStatement.kt.after new file mode 100644 index 00000000000..4766619be3a --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/afterStatement.kt.after @@ -0,0 +1,4 @@ +fun test() { + val foo = 1 /* comment1 */ + // comment2 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/blankLine.kt b/idea/testData/intentions/convertLineCommentToBlockComment/blankLine.kt new file mode 100644 index 00000000000..d6e778c13db --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/blankLine.kt @@ -0,0 +1,12 @@ +fun test() { + // comment1 + + // + + // comment2 + + // + + // comment3 + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/blankLine.kt.after b/idea/testData/intentions/convertLineCommentToBlockComment/blankLine.kt.after new file mode 100644 index 00000000000..e7ca1080717 --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/blankLine.kt.after @@ -0,0 +1,10 @@ +fun test() { + /* + comment1 + + comment2 + + comment3 + */ + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/blockComment.kt b/idea/testData/intentions/convertLineCommentToBlockComment/blockComment.kt new file mode 100644 index 00000000000..d549fae3d1b --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/blockComment.kt @@ -0,0 +1,7 @@ +// IS_APPLICABLE: false +fun test() { + /* + comment + */ + val foo = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment.kt b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment.kt new file mode 100644 index 00000000000..8214fa2dfed --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment.kt @@ -0,0 +1,5 @@ +fun test(): Int { + // /* comment + val foo = 1 + return foo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment.kt.after b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment.kt.after new file mode 100644 index 00000000000..7576852f402 --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment.kt.after @@ -0,0 +1,5 @@ +fun test(): Int { + /* / * comment */ + val foo = 1 + return foo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment2.kt b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment2.kt new file mode 100644 index 00000000000..a4f68066ae9 --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment2.kt @@ -0,0 +1,5 @@ +fun test2(): Int { + // comment */ + val foo = 1 + return foo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment2.kt.after b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment2.kt.after new file mode 100644 index 00000000000..67ee5fcd326 --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment2.kt.after @@ -0,0 +1,5 @@ +fun test2(): Int { + /* comment * / */ + val foo = 1 + return foo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/newLinesBetweenCommentAndDeclaration.kt b/idea/testData/intentions/convertLineCommentToBlockComment/newLinesBetweenCommentAndDeclaration.kt new file mode 100644 index 00000000000..df3614904ac --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/newLinesBetweenCommentAndDeclaration.kt @@ -0,0 +1,9 @@ +fun foo() {} + + +// comment1 +// comment2 +// comment3 + + +fun bar() {} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/newLinesBetweenCommentAndDeclaration.kt.after b/idea/testData/intentions/convertLineCommentToBlockComment/newLinesBetweenCommentAndDeclaration.kt.after new file mode 100644 index 00000000000..5816d67f8cb --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/newLinesBetweenCommentAndDeclaration.kt.after @@ -0,0 +1,11 @@ +fun foo() {} + + +/* +comment1 +comment2 +comment3 +*/ + + +fun bar() {} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/simple.kt b/idea/testData/intentions/convertLineCommentToBlockComment/simple.kt new file mode 100644 index 00000000000..616a45090b0 --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/simple.kt @@ -0,0 +1,6 @@ +fun test() { + val foo = 1 + + // comment1 + val bar = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/simple.kt.after b/idea/testData/intentions/convertLineCommentToBlockComment/simple.kt.after new file mode 100644 index 00000000000..4439f5dda5f --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/simple.kt.after @@ -0,0 +1,6 @@ +fun test() { + val foo = 1 + + /* comment1 */ + val bar = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/simple2.kt b/idea/testData/intentions/convertLineCommentToBlockComment/simple2.kt new file mode 100644 index 00000000000..a530670991e --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/simple2.kt @@ -0,0 +1,8 @@ +fun test() { + val foo = 1 + + // comment1 + // comment2 + // comment3 + val bar = 1 +} \ No newline at end of file diff --git a/idea/testData/intentions/convertLineCommentToBlockComment/simple2.kt.after b/idea/testData/intentions/convertLineCommentToBlockComment/simple2.kt.after new file mode 100644 index 00000000000..36f37afa848 --- /dev/null +++ b/idea/testData/intentions/convertLineCommentToBlockComment/simple2.kt.after @@ -0,0 +1,10 @@ +fun test() { + val foo = 1 + + /* + comment1 + comment2 + comment3 + */ + val bar = 1 +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index a389112034b..da2f7aba771 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -4210,6 +4210,54 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } + @TestMetadata("idea/testData/intentions/convertBlockCommentToLineComment") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ConvertBlockCommentToLineComment extends AbstractIntentionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("afterStatement.kt") + public void testAfterStatement() throws Exception { + runTest("idea/testData/intentions/convertBlockCommentToLineComment/afterStatement.kt"); + } + + public void testAllFilesPresentInConvertBlockCommentToLineComment() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertBlockCommentToLineComment"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("beforeStatement.kt") + public void testBeforeStatement() throws Exception { + runTest("idea/testData/intentions/convertBlockCommentToLineComment/beforeStatement.kt"); + } + + @TestMetadata("blankLine.kt") + public void testBlankLine() throws Exception { + runTest("idea/testData/intentions/convertBlockCommentToLineComment/blankLine.kt"); + } + + @TestMetadata("docComment.kt") + public void testDocComment() throws Exception { + runTest("idea/testData/intentions/convertBlockCommentToLineComment/docComment.kt"); + } + + @TestMetadata("endOflineComment.kt") + public void testEndOflineComment() throws Exception { + runTest("idea/testData/intentions/convertBlockCommentToLineComment/endOflineComment.kt"); + } + + @TestMetadata("newLinesBetweenCommentAndDeclaration.kt") + public void testNewLinesBetweenCommentAndDeclaration() throws Exception { + runTest("idea/testData/intentions/convertBlockCommentToLineComment/newLinesBetweenCommentAndDeclaration.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("idea/testData/intentions/convertBlockCommentToLineComment/simple.kt"); + } + } + @TestMetadata("idea/testData/intentions/convertCamelCaseTestFunctionToSpaced") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -5127,6 +5175,59 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } + @TestMetadata("idea/testData/intentions/convertLineCommentToBlockComment") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ConvertLineCommentToBlockComment extends AbstractIntentionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("afterStatement.kt") + public void testAfterStatement() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/afterStatement.kt"); + } + + public void testAllFilesPresentInConvertLineCommentToBlockComment() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertLineCommentToBlockComment"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("blankLine.kt") + public void testBlankLine() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/blankLine.kt"); + } + + @TestMetadata("blockComment.kt") + public void testBlockComment() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/blockComment.kt"); + } + + @TestMetadata("includeBlockComment.kt") + public void testIncludeBlockComment() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment.kt"); + } + + @TestMetadata("includeBlockComment2.kt") + public void testIncludeBlockComment2() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/includeBlockComment2.kt"); + } + + @TestMetadata("newLinesBetweenCommentAndDeclaration.kt") + public void testNewLinesBetweenCommentAndDeclaration() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/newLinesBetweenCommentAndDeclaration.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/simple.kt"); + } + + @TestMetadata("simple2.kt") + public void testSimple2() throws Exception { + runTest("idea/testData/intentions/convertLineCommentToBlockComment/simple2.kt"); + } + } + @TestMetadata("idea/testData/intentions/convertNegatedBooleanSequence") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)