Bracket Matching

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 } );
JavaScript

or import the file:

<script src="path-to-the-file/bracket-matching.min.js"></script>
HTML

Options

Set an object to bracketMatching to update default options, or false to deactivate it.

new RyuseiCode( { bracketMatching: { ... } } );
// or
new RyuseiCode( { bracketMatching: false } );
JavaScript

brackets

Defines the pairs of brackets to highlight.

new RyuseiCode( {
bracketMatching: {
brackets: [
[ '(', '[', '{', '<' ],
[ ')', ']', '}', '>' ],
],
},
} );
JavaScript

type: [ string[], string[] ]
default: [ [ '(', '[', '{', '<' ], [ ')', ']', '}', '>' ] ]


maxScanLines

Limits the number of lines to scan for brackets.

type: number default: 1000