docs(lsp): include snippet to display progress using native indicator (#35176)

This commit is contained in:
Gregory Anders
2025-08-06 07:31:02 -05:00
committed by GitHub
parent a3921d2be6
commit 851a622806

View File

@@ -667,10 +667,29 @@ LspProgress *LspProgress*
properties, where `params` is the request params sent by the server (see
`lsp.ProgressParams`).
Example: >vim
Examples:
Redraw the statusline whenever an LSP progress message arrives: >vim
autocmd LspProgress * redrawstatus
<
Tell the parent terminal to indicate progress using a native progress
indicator (requires a supporting terminal): >lua
vim.api.nvim_create_autocmd('LspProgress', {
callback = function(ev)
local value = ev.data.params.value
if value.kind == 'begin' then
io.stdout:write('\027]9;4;1;0\027\\')
elseif value.kind == 'end' then
io.stdout:write('\027]9;4;0\027\\')
elseif value.kind == 'report' then
io.stdout:write(string.format('\027]9;4;1;%d\027\\', value.percentage))
end
end,
})
<
LspRequest *LspRequest*
For each request sent to an LSP server, this event is triggered for
every change to the request's status. The status can be one of