nvim: lsp: Add mapping for clearing code lens

This commit is contained in:
Sanchayan Maity 2023-01-03 19:51:53 +05:30
parent 3b0cdd49c2
commit f68aed5238
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -73,6 +73,9 @@ local lsp_key_mappings = {
{ "codeActionProvider", 'v', 'ga' , '<cmd>lua vim.lsp.buf.code_action()<CR>' },
{ "codeActionProvider", 'n', '<Leader>r', '<cmd>lua vim.lsp.buf.code_action{only = \'refactor\' }<CR>' },
{ "codeActionProvider", 'v', '<Leader>r', '<cmd>lua vim.lsp.buf.code_action{only = \'refactor\' }<CR>' },
{ "codeLensProvider", 'n', '<LocalLeader>l', '<cmd>lua vim.lsp.codelens.run()<CR>' },
{ "codeLensProvider", 'n', '<LocalLeader>L', '<cmd>lua vim.lsp.codelens.clear()<CR>' },
}
local tsserver_setup = function(client)
@ -156,7 +159,6 @@ local on_attach = function(client, bufnr)
if client.server_capabilities.codeLensProvider or client.server_capabilities.documentHighlightProvider then
if client.server_capabilities.codeLensProvider then
vim.api.nvim_buf_set_keymap(bufnr, "n", "<LocalLeader>l", "<cmd>lua vim.lsp.codelens.run()<CR>", opts)
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
group = lsp_augroup_id,
buffer = bufnr,