nvim: lsp: Add mapping for clearing code lens
This commit is contained in:
parent
3b0cdd49c2
commit
f68aed5238
1 changed files with 3 additions and 1 deletions
|
@ -73,6 +73,9 @@ local lsp_key_mappings = {
|
||||||
{ "codeActionProvider", 'v', 'ga' , '<cmd>lua vim.lsp.buf.code_action()<CR>' },
|
{ "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", '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>' },
|
{ "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)
|
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 or client.server_capabilities.documentHighlightProvider then
|
||||||
if client.server_capabilities.codeLensProvider 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"}, {
|
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
|
||||||
group = lsp_augroup_id,
|
group = lsp_augroup_id,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
|
|
Loading…
Reference in a new issue