public interface PairedBraceMatcher
Defines the brace matching support required for a custom language. For paired
brace matching to work, the language must also provide a
com.intellij.openapi.fileTypes.SyntaxHighlighter and return the correct
lexer from getHighlightingLexer().- See Also:
-
LanguageBraceMatchingBracePaircom.intellij.codeInsight.highlighting.BraceMatcherTerminationAspect
-
Method Summary
Modifier and TypeMethodDescriptionintgetCodeConstructStart(PsiFile file, int openingBraceOffset) Returns the start offset of the code construct which owns the opening structural brace at the specified offset.BracePair @NotNull []getPairs()Returns the array of definitions for brace pairs that need to be matched when editing code in the language.booleanisPairedBracesAllowedBeforeType(@NotNull IElementType lbraceType, @Nullable IElementType contextType) Returnstrueif paired rbrace should be inserted after lbrace of given type when lbrace is encountered before contextType token.
-
Method Details
-
getPairs
BracePair @NotNull [] getPairs()Returns the array of definitions for brace pairs that need to be matched when editing code in the language.- Returns:
- the array of brace pair definitions.
-
isPairedBracesAllowedBeforeType
boolean isPairedBracesAllowedBeforeType(@NotNull @NotNull IElementType lbraceType, @Nullable @Nullable IElementType contextType) Returnstrueif paired rbrace should be inserted after lbrace of given type when lbrace is encountered before contextType token. It is safe to always returntrue, then paired brace will be inserted anyway.- Parameters:
lbraceType- lbrace for which information is queriedcontextType- token type that follows lbrace- Returns:
- true / false as described
-
getCodeConstructStart
Returns the start offset of the code construct which owns the opening structural brace at the specified offset. For example, if the opening brace belongs to an 'if' statement, returns the start offset of the 'if' statement.- Parameters:
file- the file in which brace matching is performed.openingBraceOffset- the offset of an opening structural brace.- Returns:
- the offset of corresponding code construct, or the same offset if not defined.
-