mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 08:35:48 +02:00
add: config java with mason registri
This commit is contained in:
parent
9f267f2109
commit
ee86e49f17
2 changed files with 44 additions and 0 deletions
|
@ -143,3 +143,38 @@
|
||||||
-- vim.cmd(
|
-- vim.cmd(
|
||||||
-- [[command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime(<f-args>)]]
|
-- [[command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime(<f-args>)]]
|
||||||
-- )
|
-- )
|
||||||
|
|
||||||
|
local mason_reg = require("mason-registry")
|
||||||
|
for _, pkg in pairs(mason_reg.get_installed_packages()) do
|
||||||
|
for _, type in pairs(pkg.spec.categories) do
|
||||||
|
if type == "LSP" and pkg.spec.name == "jdtls" then
|
||||||
|
local ok, lspconfig = pcall(require, "lspconfig")
|
||||||
|
if not ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lspconfig.jdtls.setup({
|
||||||
|
cmd = {
|
||||||
|
"jdtls",
|
||||||
|
"-configuration",
|
||||||
|
vim.fn.expand("$HOME") .. "/.cache/jdtls/config",
|
||||||
|
"-data",
|
||||||
|
vim.fn.expand("$HOME") .. "/.cache/jdtls/workspace",
|
||||||
|
},
|
||||||
|
filetypes = { "java" },
|
||||||
|
root_dir = require("lspconfig.util").root_pattern(
|
||||||
|
-- Single-module projects
|
||||||
|
{
|
||||||
|
"build.xml", -- Ant
|
||||||
|
"pom.xml", -- Maven
|
||||||
|
"settings.gradle", -- Gradle
|
||||||
|
"settings.gradle.kts", -- Gradle
|
||||||
|
},
|
||||||
|
-- Multi-module projects
|
||||||
|
{ "build.gradle", "build.gradle.kts" }
|
||||||
|
) or vim.fn.getcwd(),
|
||||||
|
singe_file_support = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -25,3 +25,12 @@ require("custom.keymaps")
|
||||||
-- vim.cmd("colorscheme onedark")
|
-- vim.cmd("colorscheme onedark")
|
||||||
-- vim.cmd("colorscheme github_dark_dimmed")
|
-- vim.cmd("colorscheme github_dark_dimmed")
|
||||||
-- vim.cmd("colorscheme github_dark_high_contrast")
|
-- vim.cmd("colorscheme github_dark_high_contrast")
|
||||||
|
|
||||||
|
-- local mason_reg = require("mason-registry")
|
||||||
|
-- for _, pkg in pairs(mason_reg.get_installed_packages()) do
|
||||||
|
-- for _, type in pairs(pkg.spec.categories) do
|
||||||
|
-- if type == "LSP" and pkg.spec.name == "jdtls" then
|
||||||
|
-- print("JDTLS READY")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue