接口 PairedBraceMatcher


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 fleet.com.intellij.openapi.fileTypes.SyntaxHighlighter and return the correct lexer from getHighlightingLexer().
另请参阅:
  • LanguageBraceMatching
  • BracePair
  • fleet.com.intellij.codeInsight.highlighting.BraceMatcherTerminationAspect
  • 方法概要

    修饰符和类型
    方法
    说明
    int
    getCodeConstructStart(PsiFile file, int openingBraceOffset)
    Returns the start offset of the code construct which owns the opening structural brace at the specified offset.
    BracePair @NotNull []
    Returns the array of definitions for brace pairs that need to be matched when editing code in the language.
    boolean
    isPairedBracesAllowedBeforeType(@NotNull IElementType lbraceType, @Nullable IElementType contextType)
    Returns true if paired rbrace should be inserted after lbrace of given type when lbrace is encountered before contextType token.
  • 方法详细资料

    • getPairs

      BracePair @NotNull [] getPairs()
      Returns the array of definitions for brace pairs that need to be matched when editing code in the language.
      返回:
      the array of brace pair definitions.
    • isPairedBracesAllowedBeforeType

      boolean isPairedBracesAllowedBeforeType(@NotNull @NotNull IElementType lbraceType, @Nullable @Nullable IElementType contextType)
      Returns 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.
      参数:
      lbraceType - lbrace for which information is queried
      contextType - token type that follows lbrace
      返回:
      true / false as described
    • getCodeConstructStart

      int getCodeConstructStart(PsiFile file, int openingBraceOffset)
      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.
      参数:
      file - the file in which brace matching is performed.
      openingBraceOffset - the offset of an opening structural brace.
      返回:
      the offset of corresponding code construct, or the same offset if not defined.