Overview
The BracketMatching component highlights paired brackets when the caret is next to a bracket.
Usage
Register the BracketMatching component:
import { RyuseiCode, BracketMatching } from '@ryusei/code'; RyuseiCode.compose( { BracketMatching } );
or import the file:
<script src="path-to-the-file/bracket-matching.min.js"></script>
Options
Set an object to bracketMatching
to update default options,
or false
to deactivate it.
new RyuseiCode( { bracketMatching: { ... } } ); // or new RyuseiCode( { bracketMatching: false } );
brackets
Defines the pairs of brackets to highlight.
new RyuseiCode( { bracketMatching: { brackets: [ [ '(', '[', '{', '<' ], [ ')', ']', '}', '>' ], ], }, } );
type: [ string[], string[] ]
default: [ [ '(', '[', '{', '<' ], [ ')', ']', '}', '>' ] ]
maxScanLines
Limits the number of lines to scan for brackets.
type: number
default: 1000