Java Code Examples for com.intellij.lang.BracePair#getLeftBraceType()
The following examples show how to use
com.intellij.lang.BracePair#getLeftBraceType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CSharpDocBraceMatcher.java From consulo-csharp with Apache License 2.0 | 6 votes |
@Override public IElementType getOppositeBraceTokenType(@Nonnull final IElementType type) { PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(type.getLanguage()); if(matcher != null) { BracePair[] pairs = matcher.getPairs(); for(BracePair pair : pairs) { if(pair.getLeftBraceType() == type) { return pair.getRightBraceType(); } if(pair.getRightBraceType() == type) { return pair.getLeftBraceType(); } } } return null; }
Example 2
Source File: PairedBraceMatcherAdapter.java From consulo with Apache License 2.0 | 6 votes |
@Override @Nonnull public List<IElementType> getOppositeBraceTokenTypes(@Nonnull IElementType type) { List<IElementType> result = null; for (BracePair pair : myMatcher.getPairs()) { IElementType match = null; if (type == pair.getRightBraceType()) match = pair.getLeftBraceType(); if (type == pair.getLeftBraceType()) match = pair.getRightBraceType(); if (match != null) { if (result == null) result = new ArrayList<IElementType>(2); result.add(match); } } return result != null ? result : Collections.<IElementType>emptyList(); }
Example 3
Source File: PairedBraceMatcherAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Override public int getBraceTokenGroupId(IElementType tokenType) { final BracePair[] pairs = myMatcher.getPairs(); for (BracePair pair : pairs) { if (tokenType == pair.getLeftBraceType() || tokenType == pair.getRightBraceType()) return myLanguage.hashCode(); } return -1; }
Example 4
Source File: PairedBraceMatcherAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public BracePair findPair(boolean left, HighlighterIterator iterator, CharSequence fileText, FileType fileType) { final IElementType tokenType = iterator.getTokenType(); final BracePair[] pairs = myMatcher.getPairs(); for (BracePair pair : pairs) { if (tokenType == (left ? pair.getLeftBraceType() : pair.getRightBraceType())) return pair; } return null; }
Example 5
Source File: PairedBraceMatcherAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Override public IElementType getOppositeBraceTokenType(@Nonnull final IElementType type) { final BracePair[] pairs = myMatcher.getPairs(); for (BracePair pair : pairs) { if (type == pair.getRightBraceType()) return pair.getLeftBraceType(); if (type == pair.getLeftBraceType()) return pair.getRightBraceType(); } return null; }
Example 6
Source File: PairedBraceMatcherAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Override public boolean isPairBraces(IElementType tokenType, IElementType tokenType2) { final BracePair[] pairs = myMatcher.getPairs(); for (BracePair pair : pairs) { if (tokenType == pair.getLeftBraceType() && tokenType2 == pair.getRightBraceType() || tokenType == pair.getRightBraceType() && tokenType2 == pair.getLeftBraceType()) { return true; } } return false; }
Example 7
Source File: PairedBraceMatcherAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Override public boolean isStructuralBrace(HighlighterIterator iterator, CharSequence text, FileType fileType) { final IElementType tokenType = iterator.getTokenType(); final BracePair[] pairs = myMatcher.getPairs(); for (BracePair pair : pairs) { if (tokenType == pair.getRightBraceType() || tokenType == pair.getLeftBraceType()) return pair.isStructural(); } return false; }