enc: migrate java from nvim-jdtls to lsp jdtls

This commit is contained in:
asep.komarudin 2024-06-25 16:58:01 +07:00
parent 4bd718cab7
commit 2d1579c969
6 changed files with 200 additions and 191 deletions

View file

@ -1,9 +1,9 @@
local M = {}
if pcode.active_java_config.active then
M = {
{
"mfussenegger/nvim-jdtls",
},
-- {
-- "mfussenegger/nvim-jdtls",
-- },
{
"nvim-neotest/neotest",
dependencies = {
@ -46,33 +46,33 @@ if pcode.active_java_config.active then
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
},
},
{
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = function(_, opts)
local psave = pcode.format_on_save or 0
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.java = { "lsp_fmt" }
if psave == 1 then
opts.format_on_save = {
timeout_ms = pcode.format_timeout_ms or 500,
lsp_fallback = true,
}
end
return opts
end,
config = function(_, opts)
local conform = require("conform")
conform.setup(opts)
vim.keymap.set({ "n", "v" }, "<leader>lF", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = pcode.format_timeout_ms or 500,
})
end, { desc = "Format file or range (in visual mode)" })
end,
},
-- {
-- "stevearc/conform.nvim",
-- event = { "BufReadPre", "BufNewFile" },
-- opts = function(_, opts)
-- local psave = pcode.format_on_save or 0
-- opts.formatters_by_ft = opts.formatters_by_ft or {}
-- opts.formatters_by_ft.java = { "lsp_fmt" }
-- if psave == 1 then
-- opts.format_on_save = {
-- timeout_ms = pcode.format_timeout_ms or 500,
-- lsp_fallback = true,
-- }
-- end
-- return opts
-- end,
-- config = function(_, opts)
-- local conform = require("conform")
-- conform.setup(opts)
-- vim.keymap.set({ "n", "v" }, "<leader>lF", function()
-- conform.format({
-- lsp_fallback = true,
-- async = false,
-- timeout_ms = pcode.format_timeout_ms or 500,
-- })
-- end, { desc = "Format file or range (in visual mode)" })
-- end,
-- },
}
end
return M