]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Quickfix population based on LSP
authorSergey Matveev <stargrave@stargrave.org>
Tue, 23 Nov 2021 11:27:10 +0000 (14:27 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 27 Jan 2022 11:35:14 +0000 (14:35 +0300)
vim/.vim/autoload/mylsp.vim [new file with mode: 0644]
vim/.vim/plugin/lsp.vim

diff --git a/vim/.vim/autoload/mylsp.vim b/vim/.vim/autoload/mylsp.vim
new file mode 100644 (file)
index 0000000..42b05ad
--- /dev/null
@@ -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
index bcef27286c0acccd5837ce86168f19002fa99063..c7930b4e24cba965045381963e153cb155d71936 100644 (file)
@@ -18,3 +18,5 @@ augroup lsp_install
     autocmd!
     autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
 augroup END
+
+map <F6> :call mylsp#qfpopulate()<CR>:copen<CR>