mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 08:35:48 +02:00
enc: java default cconfig
This commit is contained in:
parent
f0f7958de7
commit
cecf29d7db
9 changed files with 247 additions and 73 deletions
|
@ -18,16 +18,17 @@
|
|||
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "c501b429cf995c645454539b924aaefae45bb9eb" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "4ea9fe060042f345960ad0c01aa7bca91405e10a" },
|
||||
"lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "f5425eb1d0d794f0305d5eeebddabb74614683ff" },
|
||||
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "f0d7faa064c892b96997810afcddfadc3f2a15b3" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "f15c61e71318b16c6616c2ace907136b76674f13" },
|
||||
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
||||
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
||||
"neotest-gtest": { "branch": "main", "commit": "b44c8afc26cea75ffc80617ce07b4e745a56e589" },
|
||||
"neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" },
|
||||
"noice.nvim": { "branch": "main", "commit": "8f1d9966762e62fa8788e5fb1a5f6a86784221d9" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" },
|
||||
|
@ -35,6 +36,10 @@
|
|||
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||
"nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" },
|
||||
"nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
|
||||
"nvim-material-icon": { "branch": "main", "commit": "2f1d6333bbec2e787774193c9fc7b447b878069a" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
|
|
|
@ -159,4 +159,8 @@ pcode.active_javascript_config = {
|
|||
pcode.active_php_config = false
|
||||
pcode.active_golang_config = false
|
||||
pcode.active_python_config = false
|
||||
pcode.active_cpp_config = true
|
||||
pcode.active_cpp_config = false
|
||||
pcode.active_java_config = {
|
||||
active = true,
|
||||
project = "gradle", -- gradle or maven
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
local null_ls = require("null-ls")
|
||||
local m = {
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua, -- tambahkan di bawah sini
|
||||
-- null_ls.builtins.diagnostics.flake8, -- tambahkan di bawah sini
|
||||
-- null_ls.builtins.formatting.blade_formatter.with({ filetypes = { "blade", "php" } }),
|
||||
-- null_ls.builtins.formatting.stylua, -- tambahkan di bawah sini
|
||||
-- null_ls.builtins.formatting.clang_format.with({ filetypes = { "c", "cpp" } }),
|
||||
--null_ls.builtins.diagnostics.flake8, -- tambahkan di bawah sini
|
||||
--null_ls.builtins.formatting.blade_formatter.with({ filetypes = { "blade", "php" } }),
|
||||
},
|
||||
}
|
||||
return m
|
||||
|
|
|
@ -3,6 +3,15 @@ local M = {}
|
|||
-- local file_name_no_ext = vim.fn.expand("%:t:r")
|
||||
if pcode.active_cpp_config then
|
||||
M = {
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
table.insert(opts.sources, nls.builtins.formatting.clang_format.with({ filetypes = { "cpp", "c" } }))
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
ft = { "cpp" },
|
||||
|
|
107
lua/plugins/java.lua
Normal file
107
lua/plugins/java.lua
Normal file
|
@ -0,0 +1,107 @@
|
|||
local M = {}
|
||||
if pcode.active_java_config.active then
|
||||
M = {
|
||||
{
|
||||
"mfussenegger/nvim-jdtls",
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
dependencies = {
|
||||
"nvim-neotest/nvim-nio",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"andy-bell101/neotest-java",
|
||||
},
|
||||
config = function()
|
||||
require("neotest").setup({
|
||||
adapters = {
|
||||
require("neotest-java")({
|
||||
-- function to determine which runner to use based on project path
|
||||
determine_runner = function(project_root_path)
|
||||
-- return should be "maven" or "gradle"
|
||||
return pcode.active_java_config.project or "gradle"
|
||||
end,
|
||||
-- override the builtin runner discovery behaviour to always use given
|
||||
-- tool. Default is "nil", so no override
|
||||
force_runner = nil,
|
||||
-- if the automatic runner discovery can't uniquely determine whether
|
||||
-- to use Gradle or Maven, fallback to using this runner. Default is
|
||||
-- "gradle"
|
||||
fallback_runner = pcode.active_java_config.project or "gradle",
|
||||
}),
|
||||
},
|
||||
})
|
||||
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" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
event = "BufReadPre",
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"nvim-neotest/nvim-nio",
|
||||
"williamboman/mason.nvim",
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("user.dapui")
|
||||
local dap = require("dap")
|
||||
local util = require("jdtls.util")
|
||||
dap.adapters.java = function(callback)
|
||||
util.execute_command({ command = "vscode.java.startDebugSession" }, function(err0, port)
|
||||
if err0 ~= nil then
|
||||
return
|
||||
end
|
||||
callback({ type = "server", host = "127.0.0.1", port = port })
|
||||
end)
|
||||
end
|
||||
dap.configurations.java = {
|
||||
{
|
||||
type = "java",
|
||||
request = "launch",
|
||||
name = "Debug Java",
|
||||
program = "${file}",
|
||||
args = {},
|
||||
cwd = vim.fn.getcwd(),
|
||||
stopOnEntry = false,
|
||||
console = "integratedTerminal",
|
||||
internalConsoleOptions = "neverOpen",
|
||||
sourceMaps = true,
|
||||
outDir = "${workspaceFolder}/out",
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>d", "", desc = " Debug" },
|
||||
{ "<leader>dt", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", desc = "Toggle Breakpoint" },
|
||||
{ "<leader>db", "<cmd>lua require'dap'.step_back()<cr>", desc = "Step Back" },
|
||||
{ "<leader>dc", "<cmd>lua require'dap'.continue()<cr>", desc = "Continue" },
|
||||
{ "<leader>dC", "<cmd>lua require'dap'.run_to_cursor()<cr>", desc = "Run To Cursor" },
|
||||
{ "<leader>dd", "<cmd>lua require'dap'.disconnect()<cr>", desc = "Disconnect" },
|
||||
{ "<leader>dg", "<cmd>lua require'dap'.session()<cr>", desc = "Get Session" },
|
||||
{ "<leader>di", "<cmd>lua require'dap'.step_into()<cr>", desc = "Step Into" },
|
||||
{ "<leader>do", "<cmd>lua require'dap'.step_over()<cr>", desc = "Step Over" },
|
||||
{ "<leader>du", "<cmd>lua require'dap'.step_out()<cr>", desc = "Step Out" },
|
||||
{ "<leader>dp", "<cmd>lua require'dap'.pause()<cr>", desc = "Pause" },
|
||||
{ "<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", desc = "Toggle Repl" },
|
||||
{ "<leader>ds", "<cmd>lua require'dap'.continue()<cr>", desc = "Start" },
|
||||
{ "<leader>dq", "<cmd>lua require'dap'.close()<cr>", desc = "Quit" },
|
||||
{ "<leader>dU", "<cmd>lua require'dapui'.toggle({reset = true})<cr>", desc = "Toggle UI" },
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
return M
|
|
@ -27,22 +27,4 @@ return {
|
|||
require("user.lsp")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jayp0521/mason-null-ls.nvim",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
"nvimtools/none-ls.nvim",
|
||||
dependencies = {
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
lazy = true,
|
||||
},
|
||||
config = function()
|
||||
require("user.lsp.null-lscfg")
|
||||
end,
|
||||
},
|
||||
event = "InsertEnter",
|
||||
opts = function()
|
||||
require("user.mason-null-ls")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
58
lua/plugins/nonels.lua
Normal file
58
lua/plugins/nonels.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
return {
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{
|
||||
"jayp0521/mason-null-ls.nvim",
|
||||
opts = {
|
||||
ensure_installed = pcode.null_ls_ensure_installed or {},
|
||||
automatic_setup = true,
|
||||
handlers = {},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mason-null-ls").setup(opts)
|
||||
end,
|
||||
},
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
},
|
||||
event = "InsertEnter",
|
||||
opts = function()
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local sources = {}
|
||||
local data_ok, data_sources = pcall(require, "custom.null-ls")
|
||||
if data_ok then
|
||||
for _, cfg in pairs(data_sources.sources) do
|
||||
table.insert(sources, cfg)
|
||||
end
|
||||
end
|
||||
local on_save = pcode.format_on_save or 0
|
||||
if on_save == 1 then
|
||||
return {
|
||||
debug = false,
|
||||
sources = sources,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
else
|
||||
return {
|
||||
debug = false,
|
||||
sources = sources,
|
||||
}
|
||||
end
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("null-ls").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -83,4 +83,12 @@ if pcode.active_cpp_config then
|
|||
table.insert(pcode.dap_ensure_installed, "codelldb")
|
||||
pcode.nvim_dap = true
|
||||
end
|
||||
-- run if java config true
|
||||
if pcode.active_java_config then
|
||||
table.insert(pcode.treesitter_ensure_installed, "java")
|
||||
table.insert(pcode.mason_ensure_installed, "jdtls")
|
||||
table.insert(pcode.dap_ensure_installed, "javadbg")
|
||||
table.insert(pcode.dap_ensure_installed, "javatest")
|
||||
table.insert(pcode.unregister_lsp, "jdtls")
|
||||
end
|
||||
return {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue