vim-lsp icon indicating copy to clipboard operation
vim-lsp copied to clipboard

Automatically update diagnostics location list

Open kflu opened this issue 3 years ago • 9 comments

Is there a way to automatically update the diagnostics location list as I type? Currently it seems the behavior is that I've to manually invoke :LspDocumentDiagnostics in order to update the location list with new diagnostics.

kflu avatar Aug 25 '21 08:08 kflu

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 24 '21 08:10 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 25 '21 14:12 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 13 '22 20:03 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 19 '22 06:06 stale[bot]

ping on this, i was wondering the best way to do this as well.

amj avatar Feb 13 '23 01:02 amj

I imagine this doesn't handle some edge cases correctly, but it's working well for me:

M.au_loclist = "BukzorLspLocList"

function M.update_loclist_if_visible()
  local loclist = vim.fn.getloclist(0, { winid = 0 })
  if loclist.winid ~= 0 then
    vim.diagnostic.setloclist()
  end
end

function M.setup_loclist_update()
  vim.api.nvim_create_augroup(M.au_loclist, { clear = true })
  vim.api.nvim_create_autocmd("DiagnosticChanged", {
    group = M.au_loclist,
    callback = M.update_loclist_if_visible,
  })
end

ghost avatar May 01 '23 15:05 ghost

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 17 '23 03:09 stale[bot]

+1 from me - I can get this from ALE (which I use alongside this), so it isn't a deal breaker, but it seems an obvious "win" for the "one true vim way" ;-)

yatesco avatar Nov 23 '23 16:11 yatesco

Easily the feature I'd like to see the most from this package.

I'm curious, though: why do folks run both vim-lsp and ALE at the same time?

barreyra avatar Dec 20 '23 12:12 barreyra