~whynothugo/lsp_lines.nvim#16: 
Diagnostics don't appear on last line

I find that diagnostics don't appear using lsp_lines if they are on the last line of a file. Signs and virtual text still appear, but not the lsp_lines diagnostics. Adding even just an empty/blank line to the end of the file is enough to then trigger them to display.

NeoVim 0.7.2 on Mac, lsp_lines commit db67e94c813

Status
REPORTED
Submitter
~andrewferrier
Assigned to
No-one
Submitted
2 years ago
Updated
2 years ago
Labels
No labels applied.

~whynothugo 2 years ago

Works for me:

    1 # Empty line below:
W   2
      └──── [W391] blank line at end of file (flake8)

Are you using nvim itself, or some alternative GUI?

-- Hugo Osvaldo Barrera

~andrewferrier 2 years ago

nvim itself.

I think I've found the problem. It looks like virtual lines are not treated as lines that can be scrolled to. For example, assume a relatively long file; longer than the screen. Create a diagnostic (e.g. syntax error) on the last line, just like in your example. Scroll to the top of the file, then scroll to the bottom again using the G key. The scrolling stops on the last line and you cannot see the diagnostic. Even pressing <Down> does not display the diagnostic.

Now, scroll via half-pages instead by pressing Ctrl-F. Now the diagnostic is visible.

So there is a workaround here, albeit one which isn't immediately obvious (because you have to know the diagnostic is there, presumably via some other method like signs, which you might not being using). Personally I don't scroll using Ctrl-F much, maybe some other people do.

I'm not sure what the right fix is here. Maybe the NeoVim developers didn't envisage virtual lines below the bottom line, although obviously it does support them. I understand why they would need to be treated differently from 'real' buffer lines, and why scrolling stops where it does, but it is confusing. Maybe the right approach would be for the screen to continue to scroll until all virtual lines are shown, but for the cursor not to move.

What are you thinking? Is there a bug to raise against NeoVim here?

~whynothugo 2 years ago

I understand and agree on the issue, but I have no idea how to address this.

You can scroll past the last line using Ctrl+e or mouse-wheel scrolling. set scrolloff doesn't apply in this case. Maybe :h scroll-cursor has something else of use?

I'm not sure it's a bug either TBH; if you ask upstream let me know what you hear.

-- Hugo Osvaldo Barrera

~andrewferrier 2 years ago

OK, I'll open a bug upstream to test the waters for whether this is considered an issue. Will post the link back here once done.

~whynothugo 2 years ago

Please keep me posted on any findings.

~andrewferrier 2 years ago*

Issue raised: https://github.com/neovim/neovim/issues/19605 . Obviously feel free to contribute.

Register here or Log in to comment, or comment via email.