Range bug with LSP textDocument/publishDiagnostics

I was working on a LSP extension for GitHub - bscan/PerlNavigator: Perl Language Server that includes syntax checking, perl critic, and code navigation

It sends a textDocument/publishDiagnostics response that includes:

"range" : {
          "end" : {
            "character" : 500,
            "line" : 24
          },
          "start" : {
            "character" : 0,
            "line" : 24
          }
        },

Looking at the source, that 500 number is just an arbitrary high hardcoded value (probably because perlcritic output just provides a single line number to the LSP).

Even though the line number value is the same for the start and end range, nova still underlines the next several lines until it reaches exactly 500 characters.

Having a hardcoded character number here might be wrong of the LSP – but I don’t think nova means to be underlining text for line numbers that aren’t included in the range.

Thank you for the report. I agree, this is lack of clarity in the LSP but Nova can also sanitize these values in a better way.

1 Like