Search in sources :

Example 1 with IXmlLeafElementType

use of com.intellij.psi.tree.xml.IXmlLeafElementType in project intellij-community by JetBrains.

the class XmlBraceMatcher method getBraceTokenGroupId.

@Override
public int getBraceTokenGroupId(IElementType tokenType) {
    final Language l = tokenType.getLanguage();
    PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(l);
    if (matcher != null) {
        BracePair[] pairs = matcher.getPairs();
        for (BracePair pair : pairs) {
            if (pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType) {
                return l.hashCode();
            }
        }
    }
    if (tokenType instanceof IXmlLeafElementType) {
        return tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER || tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER ? XML_VALUE_DELIMITER_GROUP : XML_TAG_TOKEN_GROUP;
    } else {
        return BraceMatchingUtil.UNDEFINED_TOKEN_GROUP;
    }
}
Also used : PairedBraceMatcher(com.intellij.lang.PairedBraceMatcher) Language(com.intellij.lang.Language) IXmlLeafElementType(com.intellij.psi.tree.xml.IXmlLeafElementType) BracePair(com.intellij.lang.BracePair)

Aggregations

BracePair (com.intellij.lang.BracePair)1 Language (com.intellij.lang.Language)1 PairedBraceMatcher (com.intellij.lang.PairedBraceMatcher)1 IXmlLeafElementType (com.intellij.psi.tree.xml.IXmlLeafElementType)1