vim-lsp icon indicating copy to clipboard operation
vim-lsp copied to clipboard

Add support for virtual text diagnostics in Vim9

Open dotdash opened this issue 1 year ago • 5 comments

dotdash avatar Sep 18 '22 14:09 dotdash

could you also add screenshots?

prabirshrestha avatar Sep 18 '22 17:09 prabirshrestha

ss2 ss1

dotdash avatar Sep 19 '22 11:09 dotdash

The » prefix is from let g:lsp_diagnostics_virtual_text_prefix = '» '

dotdash avatar Sep 19 '22 11:09 dotdash

Often errors occured. image

mattn avatar Sep 21 '22 08:09 mattn

~Ah, I see vim-lsp only delays the processing of incoming diagnostics, but then processes all of them, including outdated ones, eidting and the textprop API then complains if a diagnostics refers to a line that no longer exists. I'll have to take a closer look at how things work, and decide whether the processing can be improved in general, or if I'll just have to drop diagnostics that refer to lines that no longer exist.~

Edit: I misunderstood what I was seeing in the logs. There "just" seems to be a race where during editing updated diagnostics come in, but aren't applied just yet due to lsp_diagnostics_virtual_text_delay, then more editing happens, and then then virtual text is created based on the old diagnostics, because the new changes are still in the didChange queue.

@prabirshrestha I'm not sure what's the best way to handle that (I'm not familiar with the code base), should I just skip diagnostics that refer to invalid lines and let it sort it itself out with the next batch of diagnostics?

Thanks!

dotdash avatar Sep 21 '22 08:09 dotdash

This is async problem, you can skip diagnostics that are in invalid line or column. We probably want is_valid_range() method that we can user everywhere for future async problems. Having flags such as disabling diagnostics for current line or insert mode can also help.

prabirshrestha avatar Oct 12 '22 02:10 prabirshrestha

Any progress on this?

ghost avatar Nov 06 '22 14:11 ghost

Should be good to go

dotdash avatar Nov 08 '22 13:11 dotdash

Check errors seem to be from the Github actions being broken, independently from my changes.

dotdash avatar Dec 01 '22 09:12 dotdash

Merged. Thanks. This looks great been using it and loving it!

prabirshrestha avatar Dec 20 '22 03:12 prabirshrestha