An efficient way of decorating all parenthesis in a line

What is the best way of stylizing all parentheses?

I have some objects, which increase the total height of the line in the editor

And it would be nice to automatically stretch () to match the height of the parent DOM element. Should it be a good job for mark decorations? I am afraid of the extra load given by spawning many small widgets.

Thanks

You can either use a MatchDecorator (as in this example), or use the syntax tree to locate the parentheses. You’ll want to find some way to set the height without querying the parent DOM geometry though, to avoid extra layouts and heights getting ‘stuck’ because the parens themselves keep the element high.

1 Like

Thanks!

Then I should probably apply mark-decoration (wrap into a span with a specific class with a defined y-scale).

I tried couple of techniques, and it looks like I anyway have to query the parents height using JS. As a compromise one could do it periodically for groups of matched parens once per n transactions or milliseconds after users input…