Region highlighters the -recurse flag

Hi all,
trying to use the -recurse flag to highlight matching parentheses and leave a regex non-capture group unmolested for additional highlighting but having no luck. Is this possible at all?

add-highlighter shared/racket/quasiquote region -recurse "\(" "`\(" "\)" regex %{(`\()(?:.*)(\))} 1:meta 2:meta

Before:
recurse-before

After:
`(div …))) see the green highlight colour but no inner repaint for keywords.
recurse-after

Just been bugging me for days, perhaps someone might know of another way around this.

Thanks, bye :wave:

Assuming shared/racket is a regions highlighter, all the regions it contains are mutually exclusive. If your keyword-highlighting exists in a different region, it won’t exist within this one.

Perhaps you could make the keyword highlighting a separate shared highlighter, and make this region highlighter a group highlighter containing (a) a ref to the keyword highlighting, and (b) this regex highlighter that colours brackets.

But I don’t wanna!! :crazy_face: Yep, lost all perspective and tried to solve the problem through tunnel vision (aka problem solving under a dictatorship).

I have your suggestion in place with kotlin.kak a perfect example. Thanks tapello.

I give it a run after dinner and report back in a couple of days for future users/reference/people/search/education.


Thanks again Screw.

recurse-regions

hook -group racket-highlight global WinSetOption filetype=racket %{
  add-highlighter -override window/racket ref racket
  add-highlighter -override window/quasi  ref quasi
  add-highlighter -override window/quote  ref quote
  add-highlighter -override window/splice ref splice

  hook -once -always window WinSetOption filetype=.* %{
    remove-highlighter window/racket
    remove-highlighter window/quasi
    remove-highlighter window/quote
    remove-highlighter window/splice
  }
}

add-highlighter -override shared/quasi  regions
add-highlighter -override shared/quote  regions
add-highlighter -override shared/splice regions

add-highlighter -override shared/quasi/quasiquote region -recurse "\(" "`\(" "\)"  regex %{(`\()(?:.*)(\))}  1:red 2:red
add-highlighter -override shared/quote/unquote    region -recurse "\(" ",\(" "\)"  regex %{(,\()(?:.*)(\))}  1:green 2:green
add-highlighter -override shared/splice/splicing  region -recurse "\(" ",@\(" "\)" regex %{(,@\()(?:.*)(\))} 1:blue 2:blue

And repaint document comments for each new region.

add-highlighter -override shared/quasi/comment  region ';' '$' fill comment
add-highlighter -override shared/quasi/comment-block  region "#\|" "\|#" fill comment

filetype plugin: kakoune-racket.kak
colour scheme: kakoune-mysticaltutor