commit e2902e9dad0a1fb66c30e82dd2867c61d0cef27c
parent 9e04b06fcf0967495610696124a69e353b53aa57
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date: Fri, 10 Jun 2022 15:29:07 +0200
feat(lsp): add progress handler
Diffstat:
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua
@@ -11,6 +11,26 @@ vim.diagnostic.config {
signs = false
}
+vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'rounded' })
+vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'rounded' })
+
+local function progress_handle(infos)
+ local new_messages = vim.lsp.util.get_progress_messages()
+ for _, msg in ipairs(new_messages) do
+ if msg.message and not msg.done then
+ vim.notify(string.format("[%s] %s ... %s", msg.name, msg.title, msg.message))
+ elseif msg.done then
+ vim.notify(string.format("[%s] %s ... DONE", msg.name, msg.title))
+ end
+ end
+ return false
+end
+
+vim.api.nvim_create_autocmd({ "User LspProgressUpdate" }, {
+ pattern = "*",
+ callback = progress_handle
+})
+
local function on_attach(client, bufnr)
local function buf_set_keymap(lhs, rhs)
vim.api.nvim_buf_set_keymap(bufnr, 'n', lhs, string.format("<cmd>lua %s<CR>", rhs),