mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-23 09:18:44 +02:00
enc: update config jdtls
This commit is contained in:
parent
e7c7785cc5
commit
03a3d5f32b
4 changed files with 33 additions and 64 deletions
|
@ -11,52 +11,17 @@ if disable then
|
|||
"stevearc/conform.nvim",
|
||||
},
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("auto-conform").setup({
|
||||
-- formatters config conform
|
||||
formatters = {
|
||||
-- yamlfix = {
|
||||
-- -- Change where to find the command
|
||||
-- command = "local/path/yamlfix",
|
||||
-- -- Adds environment args to the yamlfix formatter
|
||||
-- env = {
|
||||
-- YAMLFIX_SEQUENCE_STYLE = "block_style",
|
||||
-- },
|
||||
-- },
|
||||
},
|
||||
-- formatters_by_ft conform
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
},
|
||||
-- install mason formatter
|
||||
ensure_installed = {
|
||||
"prettier",
|
||||
},
|
||||
-- mapping masson language vs filetype
|
||||
lang_maps = {
|
||||
-- ["c++"] = "cpp",
|
||||
-- ["c#"] = "cs",
|
||||
-- ["jsx"] = "javascriptreact",
|
||||
},
|
||||
-- mappings conform name vs masonn name if not same
|
||||
name_maps = {
|
||||
-- ["cmakelang"] = "cmake_format",
|
||||
-- ["deno"] = "deno_fmt",
|
||||
-- ["elm-format"] = "elm_format",
|
||||
},
|
||||
-- add new mapping to conform
|
||||
add_new = {
|
||||
-- ["jsonc"] = {"prettier"},
|
||||
-- ["json"] = {"prettier"},
|
||||
-- ["typescriptreact"] = {"prettier"},
|
||||
},
|
||||
-- disable register mason to conform
|
||||
ignore = {
|
||||
-- ["php"] = {"tlint"},
|
||||
-- ["lua"] = {"ast-grep"},
|
||||
-- ["kotlin"] = {"ktlint"},
|
||||
},
|
||||
})
|
||||
opts = function(_, opts)
|
||||
opts.formatters = opts.formatters or {}
|
||||
opts.formatters_by_ft = opts.formatters_by_ft or {}
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
opts.lang_maps = opts.lang_maps or {}
|
||||
opts.name_maps = opts.name_maps or {}
|
||||
opts.add_new = opts.add_new or {}
|
||||
opts.ignore = opts.ignore or {}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("auto-conform").setup(opts)
|
||||
-- other conform config
|
||||
local conform = require("conform")
|
||||
conform.setup({
|
||||
|
|
|
@ -138,6 +138,7 @@ if pcode.active_java_config.active then
|
|||
if client and client.name == "jdtls" then
|
||||
local wk = require("which-key")
|
||||
wk.register({
|
||||
["<leader>c"] = { name = "+code" },
|
||||
["<leader>cx"] = { name = "+extract" },
|
||||
["<leader>cxv"] = { require("jdtls").extract_variable_all, "Extract Variable" },
|
||||
["<leader>cxc"] = { require("jdtls").extract_constant, "Extract Constant" },
|
||||
|
@ -167,15 +168,15 @@ if pcode.active_java_config.active then
|
|||
require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
|
||||
|
||||
-- Java Test require Java debugger to work
|
||||
if opts.test and mason_registry.is_installed("java-test") then
|
||||
-- custom keymaps for Java test runner (not yet compatible with neotest)
|
||||
wk.register({
|
||||
["<leader>t"] = { name = "+test" },
|
||||
["<leader>tt"] = { require("jdtls.dap").test_class, "Run All Test" },
|
||||
["<leader>tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" },
|
||||
["<leader>tT"] = { require("jdtls.dap").pick_test, "Run Test" },
|
||||
}, { mode = "n", buffer = args.buf })
|
||||
end
|
||||
-- if opts.test and mason_registry.is_installed("java-test") then
|
||||
-- -- custom keymaps for Java test runner (not yet compatible with neotest)
|
||||
-- wk.register({
|
||||
-- ["<leader>t"] = { name = "+test" },
|
||||
-- ["<leader>tt"] = { require("jdtls.dap").test_class, "Run All Test" },
|
||||
-- ["<leader>tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" },
|
||||
-- ["<leader>tT"] = { require("jdtls.dap").pick_test, "Run Test" },
|
||||
-- }, { mode = "n", buffer = args.buf })
|
||||
-- end
|
||||
end
|
||||
|
||||
-- User can set additional keymaps in opts.on_attach
|
||||
|
@ -205,13 +206,11 @@ if pcode.active_java_config.active then
|
|||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
"pojokcodeid/auto-conform.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
local package = "lsp_fmt"
|
||||
require("user.utils.masoncfg").try_install("java-debug-adapter")
|
||||
require("user.utils.masoncfg").try_install("java-test")
|
||||
opts.formatters_by_ft.java = { package }
|
||||
vim.list_extend(opts.ensure_installed, { "java-debug-adapter", "java-test" })
|
||||
opts.formatters_by_ft.java = { "lsp_fmt" }
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue