Diagnostics for the range from end of a line to the start of the next

I’ve integrated a LSP-based tool with CM6 that reports some diagnostics like this:

{ start: {line: 0, character: 7}, end: {line: 1, character: 0} }

Mapping to offsets for CodeMirror 6 I get diagnostics like { from: 7, to: 8 }.

In Visual Studio Code, the character position after the end of the line is underlined (it looks like a space at the end of the line is underlined, though there is no character at that point).

In CM6 there is no visual marker. This makes sense, but isn’t that helpful. It took me a while to spot these “missing” diagnostics. They’re in the panel and selecting them seems to highlight them but I think I’d find it confusing as a user.

I’ve adapted diagnostics that fit this pattern to instead report e.g. { from: 7, to: 7 } but thought I’d mention here.

Demo with a diagnostic on every line end-start range: Diagnostics from end-start of line - CodeSandbox

Cheers,

Matt.

1 Like

Good point. Does this patch look like a good solution?

I’ve not run, it but it looks like it does exactly what I was imagining. Thank you.