public final class CommentFoldingUtil
extends java.lang.Object
Constructor and Description |
---|
CommentFoldingUtil() |
Modifier and Type | Method and Description |
---|---|
static FoldingDescriptor |
getCommentDescriptor(PsiComment comment,
Document document,
java.util.Set<? super PsiElement> processedComments,
java.util.function.Predicate<? super PsiElement> isCustomRegionFunc,
boolean isCollapse)
Construct descriptor for comment folding.
|
static java.lang.String |
getCommentHeader(Document document,
java.lang.String commentSuffix,
java.lang.String commentPrefix,
java.lang.String linePrefix,
TextRange commentRange)
Get first non-blank line from comment.
|
static java.lang.String |
getCommentPlaceholder(Document document,
IElementType commentType,
TextRange commentRange)
Construct placeholder for comment based on its type.
|
static java.lang.String |
getCommentPlaceholder(Document document,
IElementType commentType,
TextRange commentRange,
java.lang.String replacement)
Construct placeholder for comment based on its type.
|
static java.lang.String |
getCommentPlaceholder(java.lang.String prefix,
java.lang.String suffix,
java.lang.String text,
java.lang.String replacement)
Construct comment placeholder based on rule placeholder ::= prefix[text ]replacement[suffix] .
|
static java.lang.String |
getCommentText(Document document,
java.lang.String commentSuffix,
java.lang.String commentPrefix,
java.lang.String linePrefix,
TextRange commentRange)
Get comment text excluding prefixes and suffixes.
|
public static FoldingDescriptor getCommentDescriptor(PsiComment comment, Document document, java.util.Set<? super PsiElement> processedComments, java.util.function.Predicate<? super PsiElement> isCustomRegionFunc, boolean isCollapse)
comment
- comment to folddocument
- document with commentisCollapse
- is comment collapsed by default or notprocessedComments
- already processed commentsisCustomRegionFunc
- determines whether element contains custom region tagpublic static java.lang.String getCommentPlaceholder(Document document, IElementType commentType, TextRange commentRange)
document
- document with commentcommentType
- type of commentcommentRange
- text range of commentpublic static java.lang.String getCommentPlaceholder(Document document, IElementType commentType, TextRange commentRange, java.lang.String replacement)
document
- document with commentcommentType
- type of commentcommentRange
- text range of commentreplacement
- replacement for comment content. included in placeholderpublic static java.lang.String getCommentPlaceholder(java.lang.String prefix, java.lang.String suffix, java.lang.String text, java.lang.String replacement)
text
- part of comment content to include in placeholderreplacement
- replacement for the rest of comment contentpublic static java.lang.String getCommentHeader(Document document, java.lang.String commentSuffix, java.lang.String commentPrefix, java.lang.String linePrefix, TextRange commentRange)
document
- document with commentcommentSuffix
- doc comment suffixlinePrefix
- prefix for doc comment linecommentRange
- comment text range in documentpublic static java.lang.String getCommentText(Document document, java.lang.String commentSuffix, java.lang.String commentPrefix, java.lang.String linePrefix, TextRange commentRange)
document
- document with commentcommentSuffix
- doc comment suffixcommentPrefix
- doc comment prefixlinePrefix
- prefix for doc comment linecommentRange
- comment text range in document