当前位置: 首页>>代码示例>>Java>>正文


Java JSTokenTypes.END_OF_LINE_COMMENT属性代码示例

本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.END_OF_LINE_COMMENT属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.END_OF_LINE_COMMENT属性的具体用法?Java JSTokenTypes.END_OF_LINE_COMMENT怎么用?Java JSTokenTypes.END_OF_LINE_COMMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.lang.javascript.JSTokenTypes的用法示例。


在下文中一共展示了JSTokenTypes.END_OF_LINE_COMMENT属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findFirstDocComment

private static PsiElement findFirstDocComment(PsiElement docComment)
{
	if(docComment.getNode().getElementType() == JSTokenTypes.END_OF_LINE_COMMENT)
	{
		while(true)
		{
			PsiElement prev = docComment.getPrevSibling();
			if(prev instanceof PsiWhiteSpace)
			{
				prev = prev.getPrevSibling();
			}
			if(prev == null)
			{
				break;
			}
			if(prev.getNode().getElementType() != JSTokenTypes.END_OF_LINE_COMMENT)
			{
				break;
			}
			docComment = prev;
		}
	}
	return docComment;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:24,代码来源:JSDocumentationProvider.java

示例2: visitEmbeddedContent

@Override
public void visitEmbeddedContent(final ASTNode node)
{
	if(type2 == JSTokenTypes.END_OF_LINE_COMMENT)
	{
		myResult = Spacing.createSpacing(0, Integer.MAX_VALUE, 0, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
	}
	else if(JSElementTypes.SOURCE_ELEMENTS.contains(type1) ||
			JSElementTypes.SOURCE_ELEMENTS.contains(type2) && type1 != JSTokenTypes.DOT ||
			type2 == JSTokenTypes.RBRACE)
	{
		myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:14,代码来源:JSSpacingProcessor.java

示例3: visitFile

@Override
public void visitFile(final ASTNode node)
{
	if(JSElementTypes.SOURCE_ELEMENTS.contains(type1) || JSElementTypes.SOURCE_ELEMENTS.contains(type2))
	{
		if(type2 == JSTokenTypes.END_OF_LINE_COMMENT && isInlineEndOfLineCommentOnLeft() && type1 != JSElementTypes.IMPORT_STATEMENT)
		{
			myResult = Spacing.getReadOnlySpacing();
		}
		else
		{
			if((JSElementTypes.IMPORT_STATEMENT == type1 && JSElementTypes.IMPORT_STATEMENT != type2) || (JSElementTypes.IMPORT_STATEMENT != type1 &&
					JSElementTypes.IMPORT_STATEMENT == type2))
			{
				myResult = Spacing.createSpacing(0, 0, 2, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
			}
			else if(JSElementTypes.IMPORT_STATEMENT == type1 && JSElementTypes.IMPORT_STATEMENT == type2)
			{
				myResult = getSpacingBetweenImports();
			}
			else
			{
				if(shouldPlaceExtraLinesAroundMethod() && node.getPsi().getContext() instanceof XmlText)
				{
					myResult = Spacing.createSpacing(0, 0, 1 + mySettings.BLANK_LINES_AROUND_METHOD, mySettings.KEEP_LINE_BREAKS,
							mySettings.KEEP_BLANK_LINES_IN_CODE);
				}
				else
				{
					myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
				}
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:35,代码来源:JSSpacingProcessor.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:37,代码来源:JavaScriptFoldingBuilder.java

示例5: evaluateTypeFromVariable

private static String evaluateTypeFromVariable(final JSVariable variable)
{
	PsiElement prevSibling = variable.getFirstChild();
	if(prevSibling != null && prevSibling.getNode().getElementType() == JSTokenTypes.IDENTIFIER)
	{
		prevSibling = variable.getPrevSibling();
	}

	if(prevSibling instanceof PsiWhiteSpace)
	{
		prevSibling = prevSibling.getPrevSibling();
	}

	if(prevSibling instanceof PsiComment && prevSibling.getNode().getElementType() != JSTokenTypes.END_OF_LINE_COMMENT)
	{
		String parameterCommentText = prevSibling.getText();
		parameterCommentText = unwrapCommentDelimiters(parameterCommentText).trim();

		if(parameterCommentText.length() > 0 && (Character.isUpperCase(parameterCommentText.charAt(0)) || parameterCommentText.indexOf(' ') == -1))
		{
			return parameterCommentText;
		}
	}

	if(prevSibling != null && prevSibling.getNode() != null && prevSibling.getNode().getElementType() == JSTokenTypes.VAR_KEYWORD)
	{
		prevSibling = variable.getParent().getPrevSibling();

		if(prevSibling instanceof PsiWhiteSpace)
		{
			prevSibling = prevSibling.getPrevSibling();
		}

		if(prevSibling instanceof PsiComment)
		{
			return findTypeFromParameter(variable, prevSibling);
		}

	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:41,代码来源:JSDocumentationUtils.java

示例6: processBlock

private void processBlock(final ASTNode node)
{
	if(JSElementTypes.SOURCE_ELEMENTS.contains(type1) || JSElementTypes.SOURCE_ELEMENTS.contains(type2) ||
			type2 == JSTokenTypes.RBRACE)
	{
		if(isInjectedJSHack(type1, type2) ||
				isInjectedJSHack(type2, type1) ||
				(type2 == JSTokenTypes.END_OF_LINE_COMMENT && isInlineEndOfLineCommentOnLeft() && type1 != JSElementTypes.IMPORT_STATEMENT))
		{
			myResult = Spacing.getReadOnlySpacing();
		}
		else
		{
			final boolean keepOneLine = myParent.getPsi() instanceof JSFunction ? mySettings.KEEP_SIMPLE_METHODS_IN_ONE_LINE : mySettings
					.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE;

			if(keepOneLine && (type1 == JSTokenTypes.LBRACE || type2 == JSTokenTypes.RBRACE))
			{
				myResult = Spacing.createDependentLFSpacing(0, 1, node.getTextRange(), mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
			}
			else
			{
				if((JSElementTypes.IMPORT_STATEMENT == type1 && JSElementTypes.IMPORT_STATEMENT != type2 && JSTokenTypes.RBRACE != type2) || (JSElementTypes
						.IMPORT_STATEMENT != type1 && JSTokenTypes.LBRACE != type1 && JSElementTypes.IMPORT_STATEMENT == type2))
				{
					myResult = Spacing.createSpacing(0, 0, 2, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
				}
				else if(JSElementTypes.IMPORT_STATEMENT == type1 && JSElementTypes.IMPORT_STATEMENT == type2)
				{
					myResult = getSpacingBetweenImports();
				}
				else
				{
					if(shouldPlaceExtraLinesAroundMethod())
					{
						myResult = Spacing.createSpacing(0, 0, 1 + mySettings.BLANK_LINES_AROUND_METHOD, mySettings.KEEP_LINE_BREAKS,
								mySettings.KEEP_BLANK_LINES_IN_CODE);
					}
					else
					{
						myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
					}
				}
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:47,代码来源:JSSpacingProcessor.java

示例7: setLineBreakSpace

private void setLineBreakSpace(final boolean needLineBreak)
{
	final int breaks = needLineBreak || myChild1.getElementType() == JSTokenTypes.END_OF_LINE_COMMENT ? 1 : 0;
	myResult = Spacing.createSpacing(1, 1, breaks, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:5,代码来源:JSSpacingProcessor.java

示例8: 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;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:55,代码来源:JavaScriptFoldingBuilder.java


注:本文中的com.intellij.lang.javascript.JSTokenTypes.END_OF_LINE_COMMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。