From cfa702e6fe2f875a2c674182fe2f86e8f613aa1e Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 3 May 2022 01:10:51 +0200 Subject: refactor: use api-autocmds for lsp functions (#2549) * refactor: use api-autocmds for lsp functions * chore: use the existing client.supports_method api * fix: a callback in an autocmd doesn't pass nil * revert: keep changes minimal to which-key Co-authored-by: Abouzar Parvan --- lua/lvim/core/which-key.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lua/lvim/core/which-key.lua') diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 21620b01..3c3cc66b 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -153,32 +153,31 @@ M.config = function() "Git Diff", }, }, - l = { name = "LSP", a = { "lua vim.lsp.buf.code_action()", "Code Action" }, d = { "Telescope diagnostics bufnr=0 theme=get_ivy", "Buffer Diagnostics" }, w = { "Telescope diagnostics", "Diagnostics" }, - f = { "lua vim.lsp.buf.formatting()", "Format" }, + f = { require("lvim.lsp.utils").format, "Format" }, i = { "LspInfo", "Info" }, I = { "LspInstallInfo", "Installer Info" }, j = { - "lua vim.diagnostic.goto_next()", + vim.diagnostic.goto_next, "Next Diagnostic", }, k = { - "lua vim.diagnostic.goto_prev()", + vim.diagnostic.goto_prev, "Prev Diagnostic", }, - l = { "lua vim.lsp.codelens.run()", "CodeLens Action" }, + l = { vim.lsp.codelens.run, "CodeLens Action" }, p = { name = "Peek", d = { "lua require('lvim.lsp.peek').Peek('definition')", "Definition" }, t = { "lua require('lvim.lsp.peek').Peek('typeDefinition')", "Type Definition" }, i = { "lua require('lvim.lsp.peek').Peek('implementation')", "Implementation" }, }, - q = { "lua vim.diagnostic.setloclist()", "Quickfix" }, - r = { "lua vim.lsp.buf.rename()", "Rename" }, + q = { vim.diagnostic.setloclist, "Quickfix" }, + r = { vim.lsp.buf.rename, "Rename" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, S = { "Telescope lsp_dynamic_workspace_symbols", -- cgit v1.2.3