lewis6991 / hover.nvim

Hover plugin framework for Neovim
MIT License
516 stars 35 forks source link

feat: add diagnostic provider #67

Closed AThePeanut4 closed 5 months ago

AThePeanut4 commented 5 months ago

Adds a provider for diagnostics. Mostly taken from vim.diagnostic.show_float, with some tweaks.

Options from vim.diagnostic.config are used for float opts like scope and severity_sort.

This required a change to open_floating_preview to work - previously if a provider returned a bufnr only, open_floating_preview would read in all the lines from the buffer and then set them again using nvim_buf_set_lines. This is both unnecessary and causes problems, such as breaking applied highlights in the case of diagnostics. open_floating_preview will now only set the buffer's lines if they are explicitly provided through the contents parameter.

Resolves #34