The code highlighting is so rad, but I think there...
# storyboard
j
The code highlighting is so rad, but I think there’s a bunch of work necessary to do it really right. In my very first sample I had a code snippet that was just the body of a function, and highlighting that really didn’t work.
💯 1
b
The highlighter uses a generated ANTLR lexer implementation based on the official kotlin spec. It's really slow; especially on web. I think it would be faster to use just the parser, but we'd need to basically reimplement the lexer, but it's a significant amount of work I just haven't found the time for yet. Hopefully someone else does it first?
As for the incorrect highlighting of the function body, you can change the
scope: CodeScope
parameter of the
highlight
function to
CodeScope.Function
so the lexer starts in the correct context.
j
oh wow, that’s super handy