2024-11-04 21:29:25 +07:00
|
|
|
local M = {}
|
2024-11-19 09:03:01 +07:00
|
|
|
local is_gradle = function()
|
|
|
|
if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
2024-11-04 21:29:25 +07:00
|
|
|
M = {
|
2024-11-11 22:47:41 +07:00
|
|
|
{
|
|
|
|
"williamboman/mason-lspconfig.nvim",
|
|
|
|
opts = function(_, opts)
|
|
|
|
opts.skip_config = opts.skip_config or {}
|
|
|
|
vim.list_extend(opts.skip_config, { "jdtls" })
|
|
|
|
end,
|
|
|
|
},
|
2024-11-16 20:14:22 +07:00
|
|
|
{
|
|
|
|
"pojokcodeid/auto-java-project.nvim",
|
|
|
|
event = "VeryLazy",
|
|
|
|
config = function()
|
|
|
|
require("auto-java-project").setup()
|
2024-11-17 10:12:07 +07:00
|
|
|
vim.keymap.set("n", "<leader>Jc", ":CreateJavaClass<cr>", { desc = "Create Java Class" })
|
|
|
|
vim.keymap.set("n", "<leader>Jm", ":CreateJavaMainClass<cr>", { desc = "Create Java Main Class" })
|
|
|
|
vim.keymap.set("n", "<leader>Ji", ":CreateJavaInterface<cr>", { desc = "Create Java Interface" })
|
2024-11-16 20:14:22 +07:00
|
|
|
end,
|
|
|
|
},
|
2024-11-11 22:47:41 +07:00
|
|
|
{
|
|
|
|
"mfussenegger/nvim-jdtls",
|
2024-11-13 05:33:40 +07:00
|
|
|
dependencies = { "pojokcodeid/auto-jdtls.nvim" },
|
2024-11-12 13:03:22 +07:00
|
|
|
ft = { "java" },
|
|
|
|
-- your opts go here
|
|
|
|
opts = {},
|
2024-11-11 22:47:41 +07:00
|
|
|
config = function(_, opts)
|
2024-11-12 13:03:22 +07:00
|
|
|
require("auto-jdtls").setup(opts)
|
2024-11-14 06:20:10 +07:00
|
|
|
require("auto-jdtls.utils").lsp_keymaps()
|
|
|
|
require("auto-jdtls.utils").jdtls_keymaps()
|
2024-11-14 21:19:48 +07:00
|
|
|
vim.keymap.set("n", "<leader>rM", ":RunMvnSpringBoot<CR>", { desc = "Run Maven Sping Boot" })
|
|
|
|
vim.keymap.set("n", "<leader>rG", ":RunGradleSpringBoot<CR>", { desc = "Run Gradle Sping Boot" })
|
|
|
|
vim.keymap.set("n", "<leader>rm", ":RunMaven<CR>", { desc = "Run Maven Project" })
|
|
|
|
vim.keymap.set("n", "<leader>rg", ":RunGradle<CR>", { desc = "Run Gradle Project" })
|
2024-11-11 22:47:41 +07:00
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"nvim-neotest/neotest",
|
|
|
|
dependencies = {
|
|
|
|
"nvim-neotest/nvim-nio",
|
|
|
|
"nvim-lua/plenary.nvim",
|
|
|
|
"antoinemadec/FixCursorHold.nvim",
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
2024-11-19 13:03:26 +07:00
|
|
|
"andy-bell101/neotest-java",
|
2024-11-11 22:47:41 +07:00
|
|
|
},
|
2024-11-19 13:03:26 +07:00
|
|
|
enabled = is_gradle(),
|
|
|
|
config = function()
|
|
|
|
require("neotest").setup({
|
2024-11-11 22:47:41 +07:00
|
|
|
adapters = {
|
2024-11-14 06:48:20 +07:00
|
|
|
require("neotest-java"),
|
2024-11-11 22:47:41 +07:00
|
|
|
},
|
2024-11-19 13:03:26 +07:00
|
|
|
})
|
2024-11-19 06:46:04 +07:00
|
|
|
end,
|
|
|
|
-- stylua: ignore
|
|
|
|
keys = {
|
|
|
|
{ "<leader>T","",desc=" Test"},
|
|
|
|
{ "<leader>Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
|
|
|
|
{ "<leader>Tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
|
|
|
|
{ "<leader>TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" },
|
|
|
|
{ "<leader>Tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
|
|
|
|
{ "<Leader>Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
|
|
|
|
{ "<leader>To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
|
|
|
|
{ "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
|
|
|
|
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
|
|
|
|
},
|
2024-11-11 22:47:41 +07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"rockerBOO/symbols-outline.nvim",
|
|
|
|
cmd = "SymbolsOutline",
|
|
|
|
config = function()
|
2024-11-14 06:43:36 +07:00
|
|
|
local icons = require("pcode.user.icons").kind
|
2024-11-11 22:47:41 +07:00
|
|
|
require("symbols-outline").setup({
|
|
|
|
symbols = {
|
2024-11-14 06:43:36 +07:00
|
|
|
File = { icon = icons.File, hl = "@text.uri" },
|
|
|
|
Module = { icon = icons.Module, hl = "@namespace" },
|
|
|
|
Namespace = { icon = icons.Namespace, hl = "@namespace" },
|
|
|
|
Package = { icon = icons.Package, hl = "@namespace" },
|
|
|
|
Class = { icon = icons.Class, hl = "@type" },
|
|
|
|
Method = { icon = icons.Method, hl = "@method" },
|
|
|
|
Property = { icon = icons.Property, hl = "@method" },
|
|
|
|
Field = { icon = icons.Field, hl = "@field" },
|
|
|
|
Constructor = { icon = icons.Constructor, hl = "@constructor" },
|
|
|
|
Enum = { icon = icons.Enum, hl = "@type" },
|
|
|
|
Interface = { icon = icons.Interface, hl = "@type" },
|
|
|
|
Function = { icon = icons.Function, hl = "@function" },
|
|
|
|
Variable = { icon = icons.Variable, hl = "@constant" },
|
|
|
|
Constant = { icon = icons.Constant, hl = "@constant" },
|
|
|
|
String = { icon = icons.String, hl = "@string" },
|
|
|
|
Number = { icon = icons.Number, hl = "@number" },
|
|
|
|
Boolean = { icon = icons.Boolean, hl = "@boolean" },
|
|
|
|
Array = { icon = icons.Array, hl = "@constant" },
|
|
|
|
Object = { icon = icons.Object, hl = "@type" },
|
|
|
|
Key = { icon = icons.Key, hl = "@type" },
|
|
|
|
Null = { icon = icons.Null, hl = "@type" },
|
|
|
|
EnumMember = { icon = icons.EnumMember, hl = "@field" },
|
|
|
|
Struct = { icon = icons.Struct, hl = "@type" },
|
|
|
|
Event = { icon = icons.Event, hl = "@type" },
|
|
|
|
Operator = { icon = icons.Operator, hl = "@operator" },
|
|
|
|
TypeParameter = { icon = icons.TypeParameter, hl = "@parameter" },
|
|
|
|
Component = { icon = icons.Component, hl = "@function" },
|
|
|
|
Fragment = { icon = icons.Fragment, hl = "@constant" },
|
2024-11-11 22:47:41 +07:00
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
keys = {
|
2024-11-14 06:20:10 +07:00
|
|
|
{ "<leader>Js", "<cmd>SymbolsOutline<cr>", desc = "Toggle Outline" },
|
2024-11-11 22:47:41 +07:00
|
|
|
},
|
|
|
|
},
|
2024-11-19 06:46:04 +07:00
|
|
|
-- project.nvim [project search + auto cd]
|
|
|
|
-- https://github.com/ahmedkhalf/project.nvim
|
|
|
|
{
|
|
|
|
"zeioth/project.nvim",
|
|
|
|
cmd = "ProjectRoot",
|
|
|
|
ft = { "java" },
|
2024-11-19 09:03:01 +07:00
|
|
|
-- enabled = vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" or false,
|
2024-11-19 06:46:04 +07:00
|
|
|
opts = {
|
|
|
|
-- How to find root directory
|
|
|
|
patterns = {
|
|
|
|
"build.gradle",
|
|
|
|
"pom.xml",
|
|
|
|
},
|
|
|
|
-- Don't list the next projects
|
|
|
|
exclude_dirs = {
|
|
|
|
"~/",
|
|
|
|
},
|
|
|
|
silent_chdir = true,
|
|
|
|
manual_mode = false,
|
|
|
|
|
|
|
|
-- Don't chdir for certain buffers
|
|
|
|
exclude_chdir = {
|
|
|
|
filetype = { "", "OverseerList", "alpha" },
|
|
|
|
buftype = { "nofile", "terminal" },
|
|
|
|
},
|
|
|
|
|
|
|
|
--ignore_lsp = { "lua_ls" },
|
|
|
|
},
|
|
|
|
config = function(_, opts)
|
|
|
|
require("project_nvim").setup(opts)
|
|
|
|
end,
|
|
|
|
},
|
2024-11-04 21:29:25 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
return M
|