Jelajahi Sumber

update some commands for jdtls

christianchiarulli 4 tahun lalu
induk
melakukan
92f6b59cda
1 mengubah file dengan 15 tambahan dan 2 penghapusan
  1. 15 2
      ftplugin/java.lua

+ 15 - 2
ftplugin/java.lua

@@ -18,11 +18,24 @@ if O.lang.java.java_tools.active then
     cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") },
     cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") },
   }
   }
 
 
+  vim.api.nvim_set_keymap(
+    "n",
+    "<leader>la",
+    ":lua require('jdtls').code_action()<CR>",
+    { noremap = true, silent = true }
+  )
+  vim.api.nvim_set_keymap(
+    "n",
+    "<leader>lR",
+    ":lua require('jdtls').code_action(false, 'refactor')<CR>",
+    { noremap = true, silent = true }
+  )
+
   vim.cmd "command! -buffer JdtCompile lua require('jdtls').compile()"
   vim.cmd "command! -buffer JdtCompile lua require('jdtls').compile()"
   vim.cmd "command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()"
   vim.cmd "command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()"
-  vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()"
+  -- vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()"
   vim.cmd "command! -buffer JdtBytecode lua require('jdtls').javap()"
   vim.cmd "command! -buffer JdtBytecode lua require('jdtls').javap()"
-  vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"
+  -- vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"
 else
 else
   local util = require "lspconfig/util"
   local util = require "lspconfig/util"