mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[javadoc] Do not format PsiMarkdownCodeBlock-s
#IDEA-371809 Fixed GitOrigin-RevId: 225e1fd572a073c3c6257aa593f5adb42b4dcebb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
59fd21dcb5
commit
be915ae443
@@ -19,6 +19,7 @@ import com.intellij.psi.impl.source.codeStyle.ShiftIndentInsideHelper;
|
||||
import com.intellij.psi.impl.source.tree.*;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.psi.impl.source.tree.java.ClassElement;
|
||||
import com.intellij.psi.javadoc.PsiMarkdownCodeBlock;
|
||||
import com.intellij.psi.jsp.JspClassLevelDeclarationStatementType;
|
||||
import com.intellij.psi.jsp.JspCodeBlockType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -204,7 +205,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
|
||||
InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)child)) {
|
||||
return new CommentWithInjectionBlock(child, wrap, alignment, indent, settings, javaSettings, formattingMode);
|
||||
}
|
||||
if (child instanceof LeafElement) {
|
||||
if (child instanceof LeafElement || child instanceof PsiMarkdownCodeBlock) {
|
||||
if (child.getElementType() == JavaTokenType.C_STYLE_COMMENT) {
|
||||
return new CStyleCommentBlock(child, actualIndent);
|
||||
}
|
||||
|
||||
@@ -2307,4 +2307,27 @@ public class Test {
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
|
||||
fun testMarkdownCodeBlocksNotAffected() {
|
||||
settings.apply {
|
||||
WRAP_COMMENTS = true
|
||||
RIGHT_MARGIN = 120
|
||||
}
|
||||
|
||||
doTextTest("""
|
||||
/// only this should be reformated
|
||||
/// ```java
|
||||
/// @Annotation public static final @Annotation2 List<String> myList = List.of("a", "b", "c");
|
||||
/// ```
|
||||
public class Foo {
|
||||
}
|
||||
""".trimIndent(), """
|
||||
/// only this should be reformated
|
||||
/// ```java
|
||||
/// @Annotation public static final @Annotation2 List<String> myList = List.of("a", "b", "c");
|
||||
/// ```
|
||||
public class Foo {
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user