dstein64 / nvim-scrollview

A Neovim plugin that displays interactive vertical scrollbars and signs.
MIT License
546 stars 10 forks source link

Show errors but not warnings from diagnostics #90

Closed galou closed 1 year ago

galou commented 1 year ago

Is it possible to show only errors from diagnostics and ignore warnings?

Thanks! Gaël

galou commented 1 year ago

I looks that the solution was in the documentation:

  diagnostics_warn_symbol = '',
  diagnostics_info_symbol = '',
  diagnostics_hint_symbol = '',
dstein64 commented 1 year ago

For the diagnostic signs, the default highlighting has the same background color as the editor. So by using no symbol, it appeared that no sign was being generated (this can be confirmed with :ScrollViewNext diagnostics, which will eventually move the cursor to a line with a warning, even though it appears there is no sign).

To fully enable/disable specific diagnostic severities, I added a configuration variable, scrollview_diagnostics_severities, a list of the severities for which signs should be shown (4add0a1bb416d349e2f6976eecb6a96bde2511a1).

To enable just error signs, here is the corresponding VimScript and Lua configuration code.

" VimScript
let g:scrollview_diagnostics_severities = [luaeval('vim.diagnostic.severity.ERROR')]
-- Lua version 1 (config variable)
vim.g.scrollview_diagnostics_severities = {vim.diagnostic.severity.ERROR}

-- Lua version 2 (as part of setup)
require('scrollview').setup({
  ...
  diagnostics_severities = {vim.diagnostic.severity.ERROR}
})

In all cases, this must be set up before the plugin is loaded (i.e., in init.vim or init.lua, loaded at startup).

Thanks for reporting the issue @galou.

galou commented 1 year ago

Woah, this was quick and unexpected (since I never used :ScrollViewNext). Thanks!