mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-379801 javadoc: fix some tests
Note that the workaround for markdown comments in JavaFoldingBuilderBase.java had to be tweaked GitOrigin-RevId: 43a24a2ef723818dd1689f6595771d24c078ac0b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ec8d530d8e
commit
db1ee2869d
+2
-2
@@ -1126,7 +1126,7 @@ public final class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
|
||||
@Override
|
||||
public void visitField(@NotNull PsiField field) {
|
||||
if (myType1 == JavaDocElementType.DOC_COMMENT) {
|
||||
if (JavaDocElementType.DOC_COMMENT_TOKENS.contains(myType1)) {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_DECLARATIONS);
|
||||
return;
|
||||
}
|
||||
@@ -1203,7 +1203,7 @@ public final class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
|
||||
@Override
|
||||
public void visitMethod(@NotNull PsiMethod method) {
|
||||
if (myType1 == JavaDocElementType.DOC_COMMENT) {
|
||||
if (JavaDocElementType.DOC_COMMENT_TOKENS.contains(myType1)) {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_DECLARATIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
+16
-13
@@ -188,20 +188,23 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
|
||||
@NotNull PsiComment comment,
|
||||
@NotNull Document document,
|
||||
@NotNull Set<? super PsiElement> processedComments) {
|
||||
final FoldingDescriptor commentDescriptor = CommentFoldingUtil.getCommentDescriptor(comment, document, processedComments,
|
||||
element -> isCustomRegionElement(element),
|
||||
isCollapseCommentByDefault(comment));
|
||||
if (commentDescriptor != null) {
|
||||
if (comment instanceof PsiDocComment && ((PsiDocComment)comment).isMarkdownComment()) {
|
||||
// Hack: Markdown comments aren't documented in the Commenter for the Java language
|
||||
// To avoid the `/** */` tokens, we remove them
|
||||
String placeHolderText = commentDescriptor.getPlaceholderText();
|
||||
if (placeHolderText != null) {
|
||||
placeHolderText = StringUtil.trimEnd(StringUtil.trimStart(placeHolderText, "/**"), "*/");
|
||||
commentDescriptor.setPlaceholderText(placeHolderText);
|
||||
}
|
||||
}
|
||||
final FoldingDescriptor commentDescriptor;
|
||||
if (comment instanceof PsiDocComment && ((PsiDocComment)comment).isMarkdownComment()) {
|
||||
// FIXME: inline documentation comments aren't supported in the Commenter interface
|
||||
if(!processedComments.add(comment)) return;
|
||||
String placeholder = CommentFoldingUtil.getCommentPlaceholder(document, JavaDocElementType.DOC_COMMENT, comment.getTextRange());
|
||||
if(placeholder == null) placeholder = "/// ...";
|
||||
// Hack: Markdown comments aren't documented in the Commenter for the Java language
|
||||
// To avoid the `/** */` tokens, we remove them
|
||||
placeholder = StringUtil.trimEnd(StringUtil.trimStart(placeholder, "/**"), "*/");
|
||||
commentDescriptor = new FoldingDescriptor(comment.getNode(), comment.getTextRange(), null, placeholder, isCollapseCommentByDefault(comment), Collections.emptySet());
|
||||
} else {
|
||||
commentDescriptor = CommentFoldingUtil.getCommentDescriptor(comment, document, processedComments,
|
||||
element -> isCustomRegionElement(element),
|
||||
isCollapseCommentByDefault(comment));
|
||||
}
|
||||
|
||||
if (commentDescriptor != null) {
|
||||
list.add(commentDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class PsiSnippetDocTagImpl extends CompositePsiElement implements PsiSnip
|
||||
@Override
|
||||
public PsiDocComment getContainingComment() {
|
||||
ASTNode scope = getTreeParent();
|
||||
while (scope.getElementType() != JavaDocElementType.DOC_COMMENT) {
|
||||
while (scope.getElementType() != JavaDocElementType.DOC_COMMENT && scope.getElementType() != JavaDocElementType.DOC_MARKDOWN_COMMENT) {
|
||||
scope = scope.getTreeParent();
|
||||
}
|
||||
return (PsiDocComment)SourceTreeToPsiMap.treeElementToPsi(scope);
|
||||
|
||||
@@ -35,7 +35,7 @@ test.java.file
|
||||
CODE_BLOCK
|
||||
LBRACE
|
||||
WHITE_SPACE
|
||||
DOC_COMMENT
|
||||
DOC_MARKDOWN_COMMENT
|
||||
DOC_COMMENT_LEADING_ASTERISKS
|
||||
DOC_COMMENT_DATA
|
||||
WHITE_SPACE
|
||||
|
||||
Reference in New Issue
Block a user