本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.DOC_COMMENT属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.DOC_COMMENT属性的具体用法?Java JSTokenTypes.DOC_COMMENT怎么用?Java JSTokenTypes.DOC_COMMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.javascript.JSTokenTypes
的用法示例。
在下文中一共展示了JSTokenTypes.DOC_COMMENT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createElement
@NotNull
@Override
public PsiElement createElement(ASTNode node)
{
final IElementType type = node.getElementType();
if(type == JSElementTypes.EMBEDDED_CONTENT)
{
return new JSEmbeddedContentImpl(node);
}
else if(type == JSTokenTypes.XML_JS_SCRIPT)
{
return new JSEmbeddedContentImpl(node);
}
else if(type == JSTokenTypes.DOC_COMMENT)
{
return new JSDocCommentImpl(node);
}
return new ASTWrapperPsiElement(node);
}
示例2: visitDocComment
@Override
public void visitDocComment(final ASTNode node)
{
final ASTNode child = node.getFirstChildNode();
if(child != null && child.getElementType() == JSTokenTypes.DOC_COMMENT)
{
visit(child);
}
else
{
super.visitDocComment(node);
}
}
示例3: isLeaf
@Override
public boolean isLeaf()
{
if(myNode.getElementType() == JSTokenTypes.DOC_COMMENT)
{
return false;
}
return myNode.getFirstChildNode() == null;
}
示例4: getPlaceholderText
@Override
public String getPlaceholderText(ASTNode node)
{
final IElementType type = node.getElementType();
if(type == JSTokenTypes.DOC_COMMENT)
{
return "/**...*/";
}
else if(type == JSTokenTypes.C_STYLE_COMMENT)
{
return "/*...*/";
}
else if(type == JSTokenTypes.END_OF_LINE_COMMENT)
{
return "//...";
}
else if(type == JSElementTypes.IMPORT_STATEMENT)
{
return "import ...";
}
else if(type == JSElementTypes.BLOCK_STATEMENT ||
type == JSElementTypes.OBJECT_LITERAL_EXPRESSION ||
type == JSElementTypes.CLASS ||
type == JSElementTypes.PACKAGE_STATEMENT)
{
return "{...}";
}
else if(type == JSElementTypes.ARRAY_LITERAL_EXPRESSION)
{
return "[...]";
}
else if(type == JSElementTypes.XML_LITERAL_EXPRESSION)
{
return "<xml/>";
}
return null;
}
示例5: isCollapsedByDefault
@Override
public boolean isCollapsedByDefault(ASTNode node)
{
if(node.getTreeParent().getElementType() instanceof JSFileElementType && node.getTreePrev() == null &&
node.getPsi() instanceof PsiComment)
{
return CodeFoldingSettings.getInstance().COLLAPSE_FILE_HEADER;
}
if(node.getElementType() == JSElementTypes.IMPORT_STATEMENT)
{
return CodeFoldingSettings.getInstance().COLLAPSE_IMPORTS;
}
return CodeFoldingSettings.getInstance().COLLAPSE_DOC_COMMENTS && node.getElementType() == JSTokenTypes.DOC_COMMENT;
}
示例6: getChildAttributes
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
Indent indent = null;
final IElementType blockElementType = myNode.getElementType();
if(blockElementType == JSTokenTypes.DOC_COMMENT)
{
return new ChildAttributes(Indent.getSpaceIndent(1), null);
}
if(blockElementType == JSElementTypes.PACKAGE_STATEMENT)
{
final JSCodeStyleSettings customSettings = CodeStyleSettingsManager.getSettings(myNode.getPsi().getProject()).getCustomSettings
(JSCodeStyleSettings.class);
if(customSettings.INDENT_PACKAGE_CHILDREN == JSCodeStyleSettings.INDENT)
{
indent = Indent.getNormalIndent();
}
else
{
indent = Indent.getNoneIndent();
}
}
else if(blockElementType == JSElementTypes.BLOCK_STATEMENT ||
blockElementType == JSElementTypes.CLASS ||
blockElementType == JSElementTypes.OBJECT_LITERAL_EXPRESSION)
{
indent = Indent.getNormalIndent();
}
else if(blockElementType instanceof JSFileElementType || blockElementType == JSElementTypes.EMBEDDED_CONTENT)
{
indent = Indent.getNoneIndent();
}
else if(JSElementTypes.SOURCE_ELEMENTS.contains(blockElementType) ||
blockElementType == JSElementTypes.FUNCTION_EXPRESSION ||
blockElementType == JSElementTypes.ATTRIBUTE_LIST)
{
indent = Indent.getNoneIndent();
}
Alignment alignment = null;
final List<Block> subBlocks = getSubBlocks();
for(int i = 0; i < newChildIndex; i++)
{
if(i == subBlocks.size())
{
break;
}
final Alignment childAlignment = subBlocks.get(i).getAlignment();
if(childAlignment != null)
{
alignment = childAlignment;
break;
}
}
// in for loops, alignment is required only for items within parentheses
if(blockElementType == JSElementTypes.FOR_STATEMENT || blockElementType == JSElementTypes.FOR_IN_STATEMENT)
{
for(int i = 0; i < newChildIndex; i++)
{
if(((JSBlock) subBlocks.get(i)).getNode().getElementType() == JSTokenTypes.RPAR)
{
alignment = null;
break;
}
}
}
return new ChildAttributes(indent, alignment);
}
示例7: appendDescriptors
private static ASTNode appendDescriptors(final ASTNode node, final Document document, final List<FoldingDescriptor> descriptors)
{
final IElementType type = node.getElementType();
if(type == JSElementTypes.BLOCK_STATEMENT ||
type == JSElementTypes.OBJECT_LITERAL_EXPRESSION ||
type == JSElementTypes.ARRAY_LITERAL_EXPRESSION ||
type == JSElementTypes.XML_LITERAL_EXPRESSION)
{
TextRange textRange = node.getTextRange();
if(textRange.getEndOffset() < document.getTextLength() && document.getLineNumber(textRange.getStartOffset()) != document.getLineNumber(textRange
.getEndOffset()))
{
addDescriptorForNode(node, descriptors);
}
}
else if(type == JSTokenTypes.DOC_COMMENT)
{
addDescriptorForNode(node, descriptors);
}
else if(type == JSTokenTypes.C_STYLE_COMMENT)
{
addDescriptorForNode(node, descriptors);
}
else if(type == JSTokenTypes.END_OF_LINE_COMMENT)
{
return collapseConsequentNodesOfSpecifiedType(node, descriptors, JSTokenTypes.END_OF_LINE_COMMENT);
}
else if(type == JSElementTypes.IMPORT_STATEMENT)
{
return collapseConsequentNodesOfSpecifiedType(node, descriptors, JSElementTypes.IMPORT_STATEMENT);
}
else if(type == JSElementTypes.CLASS || type == JSElementTypes.PACKAGE_STATEMENT)
{
ASTNode lbrace = node.findChildByType(JSTokenTypes.LBRACE);
if(lbrace != null)
{
addDescriptorForRange(node, descriptors, new TextRange(lbrace.getStartOffset(), node.getTextRange().getEndOffset()));
}
}
if(type instanceof JSFileElementType)
{
// expand chameleon
node.getPsi().getFirstChild();
}
ASTNode child = node.getFirstChildNode();
while(child != null)
{
child = appendDescriptors(child, document, descriptors).getTreeNext();
}
return node;
}