Styling active line number


I would like to style the active line number.

To do so, I forked @codemirror/gutter and modified ‘lineNumberGutter’ and ‘NumberMarker’ to add a new elementClass (‘cm-activeLineNumber’) to the GutterMarker when ‘number’ match the active line number.

Is there any other way to do that ?
I would prefer to work on top of @codemirror/gutter so I don’t have to maintain my own version of it.

Many thanks,

It seems I was working with an obsolete version of @codemirror/gutter (0.18.1) with a redraw bug.
My ‘hack’ doesn’t work on 0.18.2.

Any other idea to achieve it ?

Many thanks,

I initially had intended lineNumberMarkers to be used for something like this, but trying to actually set up an example I found that that doesn’t really work at all (it only affects the line number gutter, not other gutters, and hides the line number on the active line). So I’ve made some changes to the gutters package to add a gutterLineClass facet that can be used to style all gutter elements for a given line, and a convenience highlightActiveLineGutter exension that does what you need here.

1 Like

Perfect, thank you very much !