Did you check the docs?
Is your feature request related to a problem? Please describe.
Neovim added native support for workspace diagnostics feat(lsp): workspace diagnostic support neovim/neovim#34262
but Trouble never calls vim.lsp.buf.workspace_diagnostics()
Without that, pull-based servers never deliver workspace results
DiagnosticChanged does fire correctly for unloaded buffers once the pull is triggered
Describe the solution you'd like
add support for both push-based (already exists) and pull-based LSP diagnostics (natively supported by Neovim now) in :Trouble workspace_diagnostics
Describe alternatives you've considered
Today it is only possible to use pull-based workspace diagnostics like this in Neovim:
vim .lsp .buf .workspace_diagnostics ()
vim .diagnostic .setqflist ({ open = true })
as a workaround I added this custom Trouble source to my config
lua/trouble/sources/diagnostics_pull.lua
--- @type trouble.Source
local M = {}
local function diagnostics ()
return require ' trouble.sources.diagnostics'
end
M .highlights = {
Message = ' TroubleText' ,
ItemSource = ' Comment' ,
Code = ' Comment' ,
}
function M .setup ()
diagnostics ().setup ()
end
--- @param cb trouble.Source.Callback
--- @param ctx trouble.Source.ctx
function M .get (cb , ctx )
-- Always trigger a pull so results stay fresh.
-- DiagnosticChanged will fire and trigger auto_refresh when results arrive.
vim .lsp .buf .workspace_diagnostics ()
diagnostics ().get (cb , ctx )
end
return M
Trouble config
opts = {
modes = {
workspace_diagnostics = {
mode = ' diagnostics' ,
source = ' diagnostics_pull' ,
title = ' Workspace Diagnostics' ,
auto_refresh = true ,
auto_close = false ,
}
}
}
Additional context
No response
Did you check the docs?
Is your feature request related to a problem? Please describe.
vim.lsp.buf.workspace_diagnostics()DiagnosticChangeddoes fire correctly for unloaded buffers once the pull is triggeredDescribe the solution you'd like
add support for both push-based (already exists) and pull-based LSP diagnostics (natively supported by Neovim now) in
:Trouble workspace_diagnosticsDescribe alternatives you've considered
Today it is only possible to use pull-based workspace diagnostics like this in Neovim:
as a workaround I added this custom Trouble source to my config
lua/trouble/sources/diagnostics_pull.luaTrouble config
Additional context
No response