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()
PairedBraceMatcher
getPairs
in interface PairedBraceMatcher
public int getBraceTokenGroupId(IElementType tokenType)
getBraceTokenGroupId
in interface BraceMatcher
public 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 BraceMatcher
public boolean isRBraceToken(HighlighterIterator iterator, java.lang.CharSequence fileText, FileType fileType)
isRBraceToken
in interface BraceMatcher
public IElementType getOppositeBraceTokenType(IElementType type)
getOppositeBraceTokenType
in interface BraceMatcher
public boolean isPairBraces(IElementType tokenType, IElementType tokenType2)
isPairBraces
in interface BraceMatcher
public boolean isStructuralBrace(HighlighterIterator iterator, java.lang.CharSequence text, FileType fileType)
isStructuralBrace
in interface BraceMatcher
public boolean isPairedBracesAllowedBeforeType(IElementType lbraceType, IElementType contextType)
PairedBraceMatcher
true
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 BraceMatcher
isPairedBracesAllowedBeforeType
in interface PairedBraceMatcher
lbraceType
- lbrace for which information is queriedcontextType
- token type that follows lbracepublic int getCodeConstructStart(PsiFile file, int openingBraceOffset)
BraceMatcher
getCodeConstructStart
in interface BraceMatcher
getCodeConstructStart
in interface PairedBraceMatcher
file
- 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 NontrivialBraceMatcher
public boolean shouldStopMatch(boolean forward, IElementType braceType, HighlighterIterator iterator)
shouldStopMatch
in interface NontrivialBraceMatcher