From 851a622806a2e84ed8d53971465f3f5c2fe05d7a Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 6 Aug 2025 07:31:02 -0500 Subject: [PATCH] docs(lsp): include snippet to display progress using native indicator (#35176) --- runtime/doc/lsp.txt | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index d2d30f32f9..6ab2e563a2 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -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