Request: make mark decorations visible on empty lines

Currently mark decorations don’t show up at all on empty lines because there isn’t any character to wrap in <span>s. Perhaps this is the expected behavior, but I think it’s inappropriate in many scenarios, for example when showing lints about newlines:

The reproduction example shows a lint for each match of /\n+/g. Note that one newline shows as a point widget, which is good, but lint ranges with 2 or more newlines disappear completely. You can still open the tooltip by hovering on the empty line.

Showing a short mark (one character wide, or half of one) on empty lines would be enough. It looks manually implementable with a plugin that transforms mark decorations on empty lines into a widget decoration, but I haven’t tried (I’m new to codemirror and still learning the basics)… Would be great if support for this is built-in

Example: Try CodeMirror

Mark decorations just add a style to text in their range. If there’s no text, there’s nothing to style. So indeed, the recommended way to handle this is to make the code that creates the decorations treat empty lines specially.

I’d say the lint package wasn’t handling this situation properly. This patch should help with that.

1 Like

Thank you so much!! Your work is incredible!