From f9aeca2acae29daf28038e091cbacb57dfbc7545 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Tue, 7 Dec 2021 19:23:37 +0100 Subject: [PATCH] Deprecate custom code_action method With neovim 0.6 it is possible to use the built-in vim.lsp.buf.code_action function and still have all extensions from jdtls work. --- README.md | 6 ------ lua/jdtls.lua | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 606e0dd..b4f5ec8 100644 --- a/README.md +++ b/README.md @@ -196,12 +196,6 @@ Neovim, so all the functions mentioned in `:help lsp` will work. mappings: ```vimL --- `code_action` is a superset of vim.lsp.buf.code_action and you'll be able to --- use this mapping also with other language servers -nnoremap lua require('jdtls').code_action() -vnoremap lua require('jdtls').code_action(true) -nnoremap r lua require('jdtls').code_action(false, 'refactor') - nnoremap lua require'jdtls'.organize_imports() nnoremap crv lua require('jdtls').extract_variable() vnoremap crv lua require('jdtls').extract_variable(true) diff --git a/lua/jdtls.lua b/lua/jdtls.lua index e357f16..1dc97fe 100644 --- a/lua/jdtls.lua +++ b/lua/jdtls.lua @@ -661,6 +661,11 @@ end -- Similar to https://github.com/neovim/neovim/pull/11607, but with extensible commands function M.code_action(from_selection, kind) + if from_selection then + vim.notify('jdtls.code_action() is deprecated. You can use vim.lsp.buf.range_code_action in neovim 0.6 for the same functionality') + else + vim.notify('jdtls.code_action() is deprecated. You can use vim.lsp.buf.code_action in neovim 0.6 for the same functionality') + end local code_action_params = make_code_action_params(from_selection or false, kind) local function apply_command(action, ctx) local command