enc: update config spesifik language java

This commit is contained in:
Pojok Code 2024-11-14 06:20:10 +07:00
parent 0c56a139ec
commit 835b1706b2
10 changed files with 144 additions and 74 deletions

View file

@ -0,0 +1,23 @@
return {
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
opts = function()
local is_enabled = true
return {
-- Window mode
floating_window = is_enabled, -- Display it as floating window.
hi_parameter = "IncSearch", -- Color to highlight floating window.
handler_opts = { border = "rounded" }, -- Window style
-- Hint mode
hint_enable = false, -- Display it as hint.
hint_prefix = "👈 ",
-- Additionally, you can use <space>uH to toggle inlay hints.
toggle_key_flip_floatwin_setting = is_enabled,
}
end,
config = function(_, opts)
require("lsp_signature").setup(opts)
end,
}

View file

@ -0,0 +1,13 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"roycrippen4/telescope-treesitter-info.nvim",
},
config = function()
require("telescope").load_extension("treesitter_info")
end,
keys = {
{ "<leader>p", "<cmd>Telescope treesitter_info<cr>", desc = "Treesitter Info" },
},
}

View file

@ -2,29 +2,10 @@ local M = {}
M = {
{
"williamboman/mason-lspconfig.nvim",
-- stylua: ignore
opts = function(_, opts)
opts.skip_config = opts.skip_config or {}
vim.list_extend(opts.skip_config, { "jdtls" })
vim.keymap.set({ "n", "v" }, "<leader>l", "", { desc = "LSP" })
-- Set vim motion for <Space> + l + h to show code documentation about the code the cursor is currently over if available
vim.keymap.set("n", "<leader>lh", vim.lsp.buf.hover, { desc = "Code Hover Documentation" })
-- Set vim motion for <Space> + l + d to go where the code/variable under the cursor was defined
vim.keymap.set("n", "<leader>ld", vim.lsp.buf.definition, { desc = "Code Goto Definition" })
-- Set vim motion for <Space> + l + a for display code action suggestions for code diagnostics in both normal and visual mode
vim.keymap.set({ "n", "v" }, "<leader>la", vim.lsp.buf.code_action, { desc = "Code Actions" })
-- Set vim motion for <Space> + l + r to display references to the code under the cursor
vim.keymap.set("n", "<leader>lr", require("telescope.builtin").lsp_references, { desc = "Code Goto References" })
-- Set vim motion for <Space> + l + i to display implementations to the code under the cursor
vim.keymap.set("n", "<leader>li", require("telescope.builtin").lsp_implementations, { desc = "Code Goto Implementations" })
-- Set a vim motion for <Space> + l + <Shift>R to smartly rename the code under the cursor
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, { desc = "Code Rename" })
-- Set a vim motion for <Space> + l + <Shift>D to go to where the code/object was declared in the project (class file)
vim.keymap.set("n", "<leader>lD", vim.lsp.buf.declaration, { desc = "Code Goto Declaration" })
end,
keys = {
{ "<leader>l", "", desc = "LSP", mode = { "n", "v" } },
},
},
{
"mfussenegger/nvim-jdtls",
@ -33,52 +14,10 @@ M = {
enabled = true,
-- your opts go here
opts = {},
-- stylua: ignore
config = function(_, opts)
require("auto-jdtls").setup(opts)
-- add keymaps
vim.keymap.set('n', '<leader>J', "", { desc = "Java" })
-- Set a Vim motion to <Space> + <Shift>J + o to organize imports in normal mode
vim.keymap.set('n', '<leader>Jo', "<Cmd> lua require('jdtls').organize_imports()<CR>", { desc = "Java Organize Imports" })
-- Set a Vim motion to <Space> + <Shift>J + v to extract the code under the cursor to a variable
vim.keymap.set('n', '<leader>Jv', "<Cmd> lua require('jdtls').extract_variable()<CR>", { desc = "Java Extract Variable" })
-- Set a Vim motion to <Space> + <Shift>J + v to extract the code selected in visual mode to a variable
vim.keymap.set('v', '<leader>Jv', "<Esc><Cmd> lua require('jdtls').extract_variable(true)<CR>", { desc = "Java Extract Variable" })
-- Set a Vim motion to <Space> + <Shift>J + <Shift>C to extract the code under the cursor to a static variable
vim.keymap.set('n', '<leader>JC', "<Cmd> lua require('jdtls').extract_constant()<CR>", { desc = "Java Extract Constant" })
-- Set a Vim motion to <Space> + <Shift>J + <Shift>C to extract the code selected in visual mode to a static variable
vim.keymap.set('v', '<leader>JC', "<Esc><Cmd> lua require('jdtls').extract_constant(true)<CR>", { desc = "Java Extract Constant" })
-- Set a Vim motion to <Space> + <Shift>J + t to run the test method currently under the cursor
vim.keymap.set('n', '<leader>Jt', "<Cmd> lua require('jdtls').test_nearest_method()<CR>", { desc = "Java Test Method" })
-- Set a Vim motion to <Space> + <Shift>J + t to run the test method that is currently selected in visual mode
vim.keymap.set('v', '<leader>Jt', "<Esc><Cmd> lua require('jdtls').test_nearest_method(true)<CR>", { desc = "Java Test Method" })
-- Set a Vim motion to <Space> + <Shift>J + <Shift>T to run an entire test suite (class)
vim.keymap.set('n', '<leader>JT', "<Cmd> lua require('jdtls').test_class()<CR>", { desc = "Java Test Class" })
-- Set a Vim motion to <Space> + <Shift>J + u to update the project configuration
vim.keymap.set('n', '<leader>Ju', "<Cmd> JdtUpdateConfig<CR>", { desc = "Java Update Config" })
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "java" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
-- stylua: ignore
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "jdtls" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "java-debug-adapter", "java-test" })
opts.formatters_by_ft.java = { "lsp_fmt" }
require("auto-jdtls.utils").lsp_keymaps()
require("auto-jdtls.utils").jdtls_keymaps()
end,
},
{
@ -168,7 +107,7 @@ M = {
})
end,
keys = {
{ "<leader>S", "<cmd>SymbolsOutline<cr>", desc = "Toggle Outline" },
{ "<leader>Js", "<cmd>SymbolsOutline<cr>", desc = "Toggle Outline" },
},
},
}

View file

@ -1,6 +1,13 @@
return {
"nvim-java/nvim-java",
event = "VeryLazy",
-- event = "VeryLazy",
ft = { "java" },
dependencies = {
"MunifTanjim/nui.nvim",
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
"williamboman/mason.nvim",
},
config = function()
require("java").setup({
notifications = {

View file

@ -0,0 +1,32 @@
return {
"nvim-java/nvim-java",
-- ft = { "java" },
dependencies = {
"MunifTanjim/nui.nvim",
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
"williamboman/mason.nvim",
},
opts = {
notifications = {
dap = false,
},
jdk = {
auto_install = false,
},
-- NOTE: One of these files must be in your project root directory.
-- Otherwise the debugger will end in the wrong directory and fail.
root_markers = {
"settings.gradle",
"settings.gradle.kts",
"pom.xml",
"build.gradle",
"mvnw",
"gradlew",
"build.gradle",
"build.gradle.kts",
".git",
},
},
}

View file

@ -17,7 +17,7 @@ return {
return math.floor(vim.o.lines * 0.75)
end,
max_width = function()
return math.floor(vim.o.columns * 0.75)
return math.floor(vim.o.columns * 0.3)
end,
render = "wrapped-compact",
-- background_colour = "#00000000",

View file

@ -8,6 +8,7 @@ pcode.lang = {
java = true,
java2 = false,
java3 = false,
java4 = false,
javascript = false,
kotlin = false,
markdown = false,
@ -44,6 +45,8 @@ pcode.extras = {
visualmulti = true,
yanky = true,
zenmode = true,
lspsignatur = true,
telescopetreesiterinfo = true,
}
-- activate config themes
pcode.themes = {