adigitoleo / vim-mellow-statusline

A simple ASCII statusline for (neo)vim, best served with the mellow colorscheme
BSD Zero Clause License
9 stars 0 forks source link

support for nvim LSP diagnostics without ALE #6

Closed adigitoleo closed 9 months ago

adigitoleo commented 1 year ago

Add support for buffer diagnostics reported by a LSP (language server protocol) server like python-lsp-server. Neovim 0.8+ only. See :lua print(vim.inspect(vim.diagnostic.get())), that's what the LSP diagnostic response looks like, I guess we need a lua function to count the entries of the lua table. See :h vim.diagnostic.get and related stuff for more, there seems to be an argument to restrict the "severity" of the diagnostics in the returned table, so we could probably mimic ALE's statusbar interface then and count "errors" and "warnings" separately.

adigitoleo commented 1 year ago

Have removed ALE from my config. Now I use these mappings to jump between LSP diagnostics or open them on the loclist (see :h lopen). Will retain ALE support for Vim8 compatibility, LSP is neovim exclusive:

" Mappings for LSP and lspconfig.
nnoremap <silent> gl <Cmd>lua vim.diagnostic.setloclist()<Cr>
nnoremap <silent> ]d <Cmd>lua vim.diagnostic.goto_next()<Cr>
nnoremap <silent> [d <Cmd>lua vim.diagnostic.goto_prev()<Cr>