Different mode for current line


I have a strange requirement: style the current line with a different mode. The differences between the style of the current line and the one of the other lines is too big to be done simply by using the highlight current line mechanism.

I’ve looked around and the only mechanism I could find is to track the ‘cursoractivity’ and use marktext to change the current line styling (and remove styling from previous current line). But things get immediately tricky and using marktext is a bit like re-inventing the wheel.

I’ve also looked into passing the editor instance to the mode and call getCursor in the token method (I know…highly discouraged) but the token method is only called for the new current line (on cursor activity) and it doesn’t restyle what was previously the current line. Can I force the mode to re-run token on a specific line? maybe I can force a full refresh with setValue when the cursor moves to another line?

What do you think?


Right, just don’t go there.

Using markText for this seems like the best approach.