prabirshrestha / vim-lsp

async language server protocol plugin for vim and neovim
MIT License
3.13k stars 305 forks source link

Does `setqflist([])` waste quickfix history? #1483

Closed satorunooshie closed 1 year ago

satorunooshie commented 1 year ago

What

Does anyone know the reason calling setqflist([]) in the case below? https://github.com/prabirshrestha/vim-lsp/blob/39bad0b67eeba88bf2f0477327693c8e552044fa/autoload/lsp/ui/vim.vim#L211-L212 https://github.com/prabirshrestha/vim-lsp/blob/39bad0b67eeba88bf2f0477327693c8e552044fa/autoload/lsp/ui/vim.vim#L249-L250 https://github.com/prabirshrestha/vim-lsp/blob/39bad0b67eeba88bf2f0477327693c8e552044fa/autoload/lsp/ui/vim.vim#L466-L467 Due to this, I need to execute :colder twice to refer the previous quickfix list. I think it is enough to specify the other option such as r.

{action} values:        *setqflist-action* *E927*
'a' The items from {list} are added to the existing
    quickfix list. If there is no existing list, then a
    new list is created.

'r' The items from the current quickfix list are replaced
    with the items from {list}.  This can also be used to
    clear the list: >
        :call setqflist([], 'r')

'f' All the quickfix lists in the quickfix stack are
    freed.

Steps to reproduce

  1. Set any quickfix list :LspReference at the cursor position below https://github.com/prabirshrestha/vim-lsp/blob/master/autoload/lsp/ui/vim.vim#L5C22-L5C36
  2. :chistory
    error list 1 of 2; 0 errors     :setqflist()
    > error list 2 of 2; 4 errors     :setqflist()

    We can see the first quickfix shows 0 errors, which means the first quickfix is no needed and it wastes history. So, I want to change that.

satorunooshie commented 1 year ago

https://github.com/prabirshrestha/vim-lsp/pull/752#issuecomment-599272230 resolved thanks to vim-jp Slack