From: Sergey Matveev Date: Tue, 23 Nov 2021 11:27:10 +0000 (+0300) Subject: Quickfix population based on LSP X-Git-Url: http://www.git.stargrave.org/?p=dotfiles.git;a=commitdiff_plain;h=6b3cd1e80646e11ce56a53ccd15cb0b674dac88f Quickfix population based on LSP --- diff --git a/vim/.vim/autoload/mylsp.vim b/vim/.vim/autoload/mylsp.vim new file mode 100644 index 0000000..42b05ad --- /dev/null +++ b/vim/.vim/autoload/mylsp.vim @@ -0,0 +1,11 @@ +function! mylsp#qfpopulate() abort + let l = [] + for d in lsp#ui#vim#diagnostics#get_all_buffer_diagnostics() + call add(l, { + \"lnum": d["range"]["start"]["line"], + \"col": d["range"]["start"]["character"], + \"text": d["message"], + \"bufnr": bufnr()}) + endfor + call setqflist(l, "r") +endfunction diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim index bcef272..c7930b4 100644 --- a/vim/.vim/plugin/lsp.vim +++ b/vim/.vim/plugin/lsp.vim @@ -18,3 +18,5 @@ augroup lsp_install autocmd! autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() augroup END + +map :call mylsp#qfpopulate():copen