public class PairedBraceMatcherAdapter extends java.lang.Object implements NontrivialBraceMatcher, PairedBraceMatcher
EP_NAME| Constructor and Description |
|---|
PairedBraceMatcherAdapter(PairedBraceMatcher matcher,
Language language) |
| Modifier and Type | Method and Description |
|---|---|
BracePair |
findPair(boolean left,
HighlighterIterator iterator,
java.lang.CharSequence fileText,
FileType fileType) |
int |
getBraceTokenGroupId(IElementType tokenType) |
int |
getCodeConstructStart(PsiFile file,
int openingBraceOffset)
Returns the start offset of the code construct which owns the opening structural brace at the specified offset.
|
IElementType |
getOppositeBraceTokenType(IElementType type) |
java.util.List<IElementType> |
getOppositeBraceTokenTypes(IElementType type) |
BracePair [] |
getPairs()
Returns the array of definitions for brace pairs that need to be matched when
editing code in the language.
|
boolean |
isLBraceToken(HighlighterIterator iterator,
java.lang.CharSequence fileText,
FileType fileType) |
boolean |
isPairBraces(IElementType tokenType,
IElementType tokenType2) |
boolean |
isPairedBracesAllowedBeforeType(IElementType lbraceType,
IElementType contextType)
Returns
true if paired rbrace should be inserted after lbrace of given type when lbrace is encountered before contextType token. |
boolean |
isRBraceToken(HighlighterIterator iterator,
java.lang.CharSequence fileText,
FileType fileType) |
boolean |
isStructuralBrace(HighlighterIterator iterator,
java.lang.CharSequence text,
FileType fileType) |
boolean |
shouldStopMatch(boolean forward,
IElementType braceType,
HighlighterIterator iterator) |
public PairedBraceMatcherAdapter(PairedBraceMatcher matcher, Language language)
public BracePair [] getPairs()
PairedBraceMatchergetPairs in interface PairedBraceMatcherpublic int getBraceTokenGroupId(IElementType tokenType)
getBraceTokenGroupId in interface BraceMatcherpublic BracePair findPair(boolean left, HighlighterIterator iterator, java.lang.CharSequence fileText, FileType fileType)
public boolean isLBraceToken(HighlighterIterator iterator, java.lang.CharSequence fileText, FileType fileType)
isLBraceToken in interface BraceMatcherpublic boolean isRBraceToken(HighlighterIterator iterator, java.lang.CharSequence fileText, FileType fileType)
isRBraceToken in interface BraceMatcherpublic IElementType getOppositeBraceTokenType(IElementType type)
getOppositeBraceTokenType in interface BraceMatcherpublic boolean isPairBraces(IElementType tokenType, IElementType tokenType2)
isPairBraces in interface BraceMatcherpublic boolean isStructuralBrace(HighlighterIterator iterator, java.lang.CharSequence text, FileType fileType)
isStructuralBrace in interface BraceMatcherpublic boolean isPairedBracesAllowedBeforeType(IElementType lbraceType, IElementType contextType)
PairedBraceMatchertrue if paired rbrace should be inserted after lbrace of given type when lbrace is encountered before contextType token.
It is safe to always return true, then paired brace will be inserted anyway.isPairedBracesAllowedBeforeType in interface BraceMatcherisPairedBracesAllowedBeforeType in interface PairedBraceMatcherlbraceType - lbrace for which information is queriedcontextType - token type that follows lbracepublic int getCodeConstructStart(PsiFile file, int openingBraceOffset)
BraceMatchergetCodeConstructStart in interface BraceMatchergetCodeConstructStart in interface PairedBraceMatcherfile - the file in which brace matching is performed.openingBraceOffset - the offset of an opening structural brace.public java.util.List<IElementType> getOppositeBraceTokenTypes(IElementType type)
getOppositeBraceTokenTypes in interface NontrivialBraceMatcherpublic boolean shouldStopMatch(boolean forward,
IElementType braceType,
HighlighterIterator iterator)
shouldStopMatch in interface NontrivialBraceMatcher