From 6b3cd1e80646e11ce56a53ccd15cb0b674dac88f Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 23 Nov 2021 14:27:10 +0300 Subject: [PATCH] Quickfix population based on LSP --- vim/.vim/autoload/mylsp.vim | 11 +++++++++++ vim/.vim/plugin/lsp.vim | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 vim/.vim/autoload/mylsp.vim 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 -- 2.44.0