Add-highlighter regex: getting the middle bit `${args.drop(1).joinToString(" ")}`

Hey @yerlaser and wider community, I’m having trouble getting the middle bit ${args.drop(1).joinToString(" ")} highlighted for kotlin.kak.
yerlaser-kotlin-highlighter-strings-02
using add-highlighter regex
yerlaser-kakoune-highlighter-strings-03
yet on the next line it picks it up
yerlaser-kotlin-highlighter-strings-01
and you can see by doing
yerlaser-kakoune-highlighter-strings-05
you can get it at each correct point
yerlaser-kotlin-highlighter-strings-06

Source code is from here: https://bitbucket.org/KJ_Duncan/notes.kt/src/master/Notes.kt#lines-149

Any ideas guys on how to implement this correctly? Bye :thinking:


Tip:
before each/every copy and paste do : auto-pairs-disable
then to insert from normal mode do \i
now paste from clipboard which is not interpreted by Alex’s auto-pairs or kakoune.


Perfect Prefect Prion.
grade: A+
kotlin.kak-Screenshot 2021-07-07 212351
grade: A+
kotlin.kak-Screenshot 2021-07-07 212305
grade A+:
kotlin.kak-Screenshot 2021-07-07 212438

The triple P threat. Thanks buddy. Bye :wave:

Looks like it’s interpreting
"$date @ time\n\t${args.drop(1).joinToString("
and
")}\n$NOTES_LINE\n"
as two different strings. I suspect -recurse doesn’t work with quotes since they aren’t balanced like {}.

vim can highlight this properly, but I find vimscript ftp files unreadable so who knows how they do it. Their solution (at least for ruby) somehow applies the default file highlighter inside the interpolation but I can’t think of a way to do that without dege cases. You could try just making \$\{[^\n]*\} a region that applies the kotlin highlighting over-top the string one and allow the highlighting to break in some very rare circumstances.