From d130acc11e73e345722de442a39e70d791e17884 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Tue, 22 Oct 2024 14:19:19 +0200 Subject: [PATCH] feat!(lsp): add quickfix function --- lua/lsp.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lsp.lua b/lua/lsp.lua index eb6c689..d5beb9d 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -16,6 +16,15 @@ local on_attach = function(_, bufnr) nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('c', vim.lsp.buf.code_action, '[C]ode action') -- NOTE: to see if ca is needed + nmap('f', function() -- https://stackoverflow.com/a/74303272 + vim.lsp.buf.code_action({ + filter = function(a) + return a.isPreferred + end, + apply = true + }) + end, 'code action: [F]ix' + ) nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')