mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 05:51:25 +07:00
JoinLinesHandler: Add symmetric spacing to block comments
GitOrigin-RevId: f83830b995a9b7e33a8000d00838aa6fde5aee8d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
818325442d
commit
5d04b651ac
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
class A {
|
||||
/* foo*/ int x;
|
||||
/* foo */ int x;
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fun foo() {
|
||||
println(); /* A very important comment*/<caret> println()
|
||||
println(); /* A very important comment */<caret> println()
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fun a() {
|
||||
val a = { (a, b /* awd*//**/<caret>), c, -> }
|
||||
val a = { (a, b /* awd *//**/<caret>), c, -> }
|
||||
}
|
||||
Reference in New Issue
Block a user