JoinLinesHandler: Add symmetric spacing to block comments

GitOrigin-RevId: f83830b995a9b7e33a8000d00838aa6fde5aee8d
This commit is contained in:
Nikolaj Schumacher
2022-02-17 15:54:34 +01:00
committed by intellij-monorepo-bot
parent 818325442d
commit 5d04b651ac
5 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
class A {
// IDEA-138747
void myMethod() {
/* int myOldCodeCommentedOut; * / with an old comment (only closure)*/int somecode;
/* int myOldCodeCommentedOut; * / with an old comment (only closure) */int somecode;
}
}

View File

@@ -1,4 +1,4 @@
class A {
/* foo*/ int x;
/* foo */ int x;
}

View File

@@ -408,6 +408,10 @@ public class JoinLinesHandler extends EditorActionHandler.ForEachCaret {
String fixedSuffix = suffix.charAt(0)+" "+suffix.substring(1);
commentText = commentText.replace(suffix, fixedSuffix);
}
if (commentText.startsWith(" ") && !commentText.endsWith(" ")) {
// "// foo" should be translated to "/* foo */" not "/* foo*/"
commentText += " ";
}
try {
Project project = commentElement.getProject();
PsiParserFacade parserFacade = PsiParserFacade.SERVICE.getInstance(project);

View File

@@ -1,3 +1,3 @@
fun foo() {
println(); /* A very important comment*/<caret> println()
println(); /* A very important comment */<caret> println()
}

View File

@@ -1,3 +1,3 @@
fun a() {
val a = { (a, b /* awd*//**/<caret>), c, -> }
val a = { (a, b /* awd *//**/<caret>), c, -> }
}