diff options
Diffstat (limited to 'lua/lsp/init.lua')
-rw-r--r-- | lua/lsp/init.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 284b9dfe..2631c0fc 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -21,6 +21,25 @@ local function lsp_highlight_document(client) end end +local function lsp_code_lens_refresh(client) + if lvim.lsp.code_lens_refresh == false then + return + end + + if client.resolved_capabilities.code_lens then + vim.api.nvim_exec( + [[ + augroup lsp_code_lens_refresh + autocmd! * <buffer> + autocmd InsertLeave <buffer> lua vim.lsp.codelens.refresh() + autocmd InsertLeave <buffer> lua vim.lsp.codelens.display() + augroup END + ]], + false + ) + end +end + local function add_lsp_buffer_keybindings(bufnr) local mappings = { normal_mode = "n", @@ -99,6 +118,7 @@ function M.common_on_attach(client, bufnr) Log:debug "Called lsp.on_attach_callback" end lsp_highlight_document(client) + lsp_code_lens_refresh(client) add_lsp_buffer_keybindings(bufnr) end |