mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
rollback error jdtls
This commit is contained in:
parent
0adcd0f0aa
commit
530d54d5a6
7 changed files with 223 additions and 75 deletions
|
@ -13,39 +13,37 @@
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
"code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" },
|
"code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" },
|
||||||
"codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" },
|
"codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "60e6fbddbdf37d7790de07dc7420beefaf650e5e" },
|
|
||||||
"dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" },
|
"dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" },
|
"dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
|
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
|
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "4036c8ae9cc29faf8e6443fa5b23e679db055d24" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "37c7163f8d27243993ac07db8477e44cd5275027" },
|
"lazy.nvim": { "branch": "main", "commit": "378bfb465673a747e9e9f966e518063499e20cfe" },
|
||||||
"lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" },
|
"lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
|
||||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "f5425eb1d0d794f0305d5eeebddabb74614683ff" },
|
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
||||||
"mini.indentscope": { "branch": "main", "commit": "56d42be090e8fcc68eda69cfe55af8c5e562300e" },
|
"mini.indentscope": { "branch": "main", "commit": "56d42be090e8fcc68eda69cfe55af8c5e562300e" },
|
||||||
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
||||||
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
||||||
"neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" },
|
"neotest-java": { "branch": "main", "commit": "320f31c71b183f2c584198f33f93542fd0e5a768" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "03c6a75661e68012e30b0ed81f050358b1e2233c" },
|
"noice.nvim": { "branch": "main", "commit": "d580646db85f49b8226d52b143a458161f41954a" },
|
||||||
|
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
|
||||||
|
"none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
|
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
|
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
"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-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" },
|
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
|
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
|
||||||
"nvim-material-icon": { "branch": "main", "commit": "5ad42234d880659dfe9d4ff936c310cd6c5a1610" },
|
"nvim-material-icon": { "branch": "main", "commit": "5ad42234d880659dfe9d4ff936c310cd6c5a1610" },
|
||||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||||
"nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" },
|
"nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||||
"nvim-scrollview": { "branch": "main", "commit": "06563ae0c9928a2df42aefe66f2aed2f2943e32e" },
|
"nvim-scrollview": { "branch": "main", "commit": "fd334e5ad0c616987d1b9114890a59c97165cf83" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" },
|
"nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "cf7baac35aa5c103b960bcb3f15c690a4aa5c6f1" },
|
"nvim-treesitter": { "branch": "master", "commit": "09700b88b41ed96391de3d2010d74dc54fd5c210" },
|
||||||
|
"nvim-treesitter-context": { "branch": "master", "commit": "5efba33af0f39942e426340da7bc15d7dec16474" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" },
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
|
||||||
|
@ -55,7 +53,7 @@
|
||||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" },
|
"rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" },
|
||||||
"rest.nvim": { "branch": "main", "commit": "91badd46c60df6bd9800c809056af2d80d33da4c" },
|
"rest.nvim": { "branch": "main", "commit": "91badd46c60df6bd9800c809056af2d80d33da4c" },
|
||||||
"smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" },
|
"smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "7bd2f9b72f8449780b79bcf351534e2cd36ec43a" },
|
"telescope.nvim": { "branch": "master", "commit": "58ec6eca1c3704d130d749843e16fbf6c8cdc57e" },
|
||||||
"tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" },
|
"tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" },
|
||||||
"toggleterm.nvim": { "branch": "main", "commit": "cd55bf6aab3f88c259fa29ea86bbdcb1a325687d" },
|
"toggleterm.nvim": { "branch": "main", "commit": "cd55bf6aab3f88c259fa29ea86bbdcb1a325687d" },
|
||||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||||
|
|
|
@ -38,17 +38,12 @@ pcode.progress = 1
|
||||||
-- 4 = off
|
-- 4 = off
|
||||||
pcode.show_mode = 3
|
pcode.show_mode = 3
|
||||||
|
|
||||||
-- true or false
|
-- 1 ( format jalan) 0 (fromat off)
|
||||||
pcode.format_on_save = true
|
pcode.format_on_save = 1
|
||||||
pcode.format_timeout_ms = 5000
|
pcode.format_timeout_ms = 5000
|
||||||
|
|
||||||
-- https://github.com/mfussenegger/nvim-lint
|
|
||||||
-- https://github.com/stevearc/conform.nvim
|
|
||||||
-- use conform and nvim-lint if set true
|
|
||||||
pcode.disable_null_ls = true
|
|
||||||
|
|
||||||
pcode.treesitter_ensure_installed = {}
|
pcode.treesitter_ensure_installed = {}
|
||||||
pcode.tscontext = false
|
|
||||||
-- ini hanya untuk lsp yg tidak support masson
|
-- ini hanya untuk lsp yg tidak support masson
|
||||||
-- untuk referesi support language kunjungi link dibawah
|
-- untuk referesi support language kunjungi link dibawah
|
||||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
|
@ -70,7 +65,7 @@ pcode.mason_ensure_installed = { -- sebelumnya register_lsp
|
||||||
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
||||||
}
|
}
|
||||||
pcode.unregister_lsp = {
|
pcode.unregister_lsp = {
|
||||||
"jdtls", -- tambahkan di bawah ini
|
-- "jdtls", -- tambahkan di bawah ini
|
||||||
}
|
}
|
||||||
|
|
||||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
|
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
|
||||||
|
@ -158,7 +153,7 @@ pcode.database = false
|
||||||
pcode.rest_client = true
|
pcode.rest_client = true
|
||||||
|
|
||||||
-- https://github.com/mfussenegger/nvim-dap
|
-- https://github.com/mfussenegger/nvim-dap
|
||||||
pcode.nvim_dap = true -- not support for windows os (auto config mason-nvim-dap)
|
pcode.nvim_dap = false -- not support for windows os (auto config mason-nvim-dap)
|
||||||
|
|
||||||
-- conefig special support test & dap
|
-- conefig special support test & dap
|
||||||
pcode.active_rust_config = false
|
pcode.active_rust_config = false
|
||||||
|
@ -172,6 +167,6 @@ pcode.active_golang_config = false
|
||||||
pcode.active_python_config = false
|
pcode.active_python_config = false
|
||||||
pcode.active_cpp_config = false
|
pcode.active_cpp_config = false
|
||||||
pcode.active_java_config = {
|
pcode.active_java_config = {
|
||||||
active = true,
|
active = false,
|
||||||
project = "gradle", -- gradle or maven
|
project = "gradle", -- gradle or maven
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
if pcode.nvim_dap then
|
if vim.fn.has("win32") == 0 and pcode.nvim_dap then
|
||||||
M = {
|
M = {
|
||||||
{
|
{
|
||||||
"rcarriga/nvim-dap-ui",
|
"rcarriga/nvim-dap-ui",
|
||||||
|
@ -15,7 +15,7 @@ if pcode.nvim_dap then
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- enabled = vim.fn.has("win32") == 0,
|
enabled = vim.fn.has("win32") == 0,
|
||||||
config = function()
|
config = function()
|
||||||
require("user.dapui")
|
require("user.dapui")
|
||||||
end,
|
end,
|
||||||
|
@ -42,7 +42,7 @@ if pcode.nvim_dap then
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" },
|
dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" },
|
||||||
-- enabled = vim.fn.has("win32") == 0,
|
enabled = vim.fn.has("win32") == 0,
|
||||||
config = function()
|
config = function()
|
||||||
require("user.mason_dap")
|
require("user.mason_dap")
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -4,29 +4,6 @@ if pcode.active_java_config.active then
|
||||||
-- {
|
-- {
|
||||||
-- "mfussenegger/nvim-jdtls",
|
-- "mfussenegger/nvim-jdtls",
|
||||||
-- },
|
-- },
|
||||||
-- {
|
|
||||||
-- "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",
|
|
||||||
-- opts = function(_, opts)
|
|
||||||
-- opts.ensure_installed = opts.ensure_installed or {}
|
|
||||||
-- vim.list_extend(opts.ensure_installed, { "jdtls" })
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- "stevearc/conform.nvim",
|
|
||||||
-- event = "VeryLazy",
|
|
||||||
-- opts = function(_, opts)
|
|
||||||
-- local package="google-java-format"
|
|
||||||
-- require("user.utils.mason").try_install(package)
|
|
||||||
-- opts.formatters_by_ft.java = { package }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
{
|
{
|
||||||
"nvim-neotest/neotest",
|
"nvim-neotest/neotest",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
|
136
lua/plugins/lsp.lua
Normal file
136
lua/plugins/lsp.lua
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
lazy = true,
|
||||||
|
event = "BufRead",
|
||||||
|
cmd = {
|
||||||
|
"LspInfo",
|
||||||
|
"LspInstall",
|
||||||
|
"LspUninstall",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("lspconfig.ui.windows").default_options.border = "rounded"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
lazy = true,
|
||||||
|
cmd = {
|
||||||
|
"Mason",
|
||||||
|
"MasonInstall",
|
||||||
|
"MasonUninstall",
|
||||||
|
"MasonUninstallAll",
|
||||||
|
"MasonLog",
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local icons = vim.g.pcode_icons.ui
|
||||||
|
return {
|
||||||
|
ui = {
|
||||||
|
-- border = "none",
|
||||||
|
border = icons.Border,
|
||||||
|
icons = {
|
||||||
|
package_pending = icons.DotCircle,
|
||||||
|
package_installed = icons.CheckCircle,
|
||||||
|
package_uninstalled = icons.BlankCircle,
|
||||||
|
},
|
||||||
|
keymaps = {
|
||||||
|
-- Keymap to expand a server in the UI
|
||||||
|
toggle_server_expand = "<CR>",
|
||||||
|
-- Keymap to install the server under the current cursor position
|
||||||
|
install_server = "i",
|
||||||
|
-- Keymap to reinstall/update the server under the current cursor position
|
||||||
|
update_server = "u",
|
||||||
|
-- Keymap to check for new version for the server under the current cursor position
|
||||||
|
check_server_version = "c",
|
||||||
|
-- Keymap to update all installed servers
|
||||||
|
update_all_servers = "U",
|
||||||
|
-- Keymap to check which installed servers are outdated
|
||||||
|
check_outdated_servers = "C",
|
||||||
|
-- Keymap to uninstall a server
|
||||||
|
uninstall_server = "X",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
log_level = vim.log.levels.INFO,
|
||||||
|
max_concurrent_installers = 4,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mason").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
event = "BufReadPre",
|
||||||
|
opts = function()
|
||||||
|
local servers = { "lua_ls" }
|
||||||
|
local mason_install = pcode.mason_ensure_installed or {}
|
||||||
|
vim.list_extend(servers, mason_install)
|
||||||
|
return {
|
||||||
|
ensure_installed = servers,
|
||||||
|
automatic_installation = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mason-lspconfig").setup(opts)
|
||||||
|
|
||||||
|
local option = {}
|
||||||
|
local unregis_lsp = pcode.unregister_lsp or {}
|
||||||
|
require("mason-lspconfig").setup_handlers({
|
||||||
|
function(server_name) -- default handler (optional)
|
||||||
|
local capabilities = require("user.lsp.handlers").capabilities
|
||||||
|
if server_name == "clangd" then
|
||||||
|
capabilities.offsetEncoding = { "utf-16" }
|
||||||
|
end
|
||||||
|
local is_skip = false
|
||||||
|
local my_index = idxOf(unregis_lsp, server_name)
|
||||||
|
if my_index ~= nil then
|
||||||
|
is_skip = true
|
||||||
|
end
|
||||||
|
if not is_skip then
|
||||||
|
option = {
|
||||||
|
on_attach = require("user.lsp.handlers").on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
|
server_name = vim.split(server_name, "@")[1]
|
||||||
|
|
||||||
|
local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server_name)
|
||||||
|
if require_ok then
|
||||||
|
option = vim.tbl_deep_extend("force", conf_opts, option)
|
||||||
|
end
|
||||||
|
require("lspconfig")[server_name].setup(option)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
["jdtls"] = function()
|
||||||
|
require("lspconfig").jdtls.setup({
|
||||||
|
on_attach = require("user.lsp.handlers").on_attach,
|
||||||
|
capabilities = require("user.lsp.handlers").capabilities,
|
||||||
|
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,
|
||||||
|
})
|
||||||
|
require("user.lsp.handlers").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -2,11 +2,9 @@ return {
|
||||||
{
|
{
|
||||||
"nvimtools/none-ls.nvim",
|
"nvimtools/none-ls.nvim",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
enabled = not (pcode.disable_null_ls or false),
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
"jayp0521/mason-null-ls.nvim",
|
"jayp0521/mason-null-ls.nvim",
|
||||||
event = "VeryLazy",
|
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = pcode.null_ls_ensure_installed or {},
|
ensure_installed = pcode.null_ls_ensure_installed or {},
|
||||||
automatic_setup = true,
|
automatic_setup = true,
|
||||||
|
@ -19,7 +17,65 @@ return {
|
||||||
"nvimtools/none-ls-extras.nvim",
|
"nvimtools/none-ls-extras.nvim",
|
||||||
},
|
},
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
opts = {},
|
opts = function()
|
||||||
config = true,
|
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)
|
||||||
|
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||||
|
local filetype = vim.bo.filetype
|
||||||
|
local n = require("null-ls")
|
||||||
|
local s = require("null-ls.sources")
|
||||||
|
local method = n.methods.FORMATTING
|
||||||
|
local available_formatters = s.get_available(filetype, method)
|
||||||
|
|
||||||
|
if
|
||||||
|
(#available_formatters > 0 and client.name == "null-ls")
|
||||||
|
or client.supports_method("textDocument/formatting")
|
||||||
|
then
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = augroup,
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format({ bufnr = bufnr, timeout_ms = pcode.format_timeout_ms or 5000 })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = augroup,
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format({ bufnr = bufnr, timeout_ms = pcode.format_timeout_ms or 5000, filter = nil })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vim.schedule(function()
|
||||||
|
pcall(function()
|
||||||
|
vim.api.nvim_clear_autocmds({ group = "LspFormatting" })
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
return {
|
||||||
|
debug = false,
|
||||||
|
sources = sources,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("null-ls").setup(opts)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,20 +37,6 @@ _G.idxOf = function(array, value)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.unique_list = function(list)
|
|
||||||
local seen = {}
|
|
||||||
local result = {}
|
|
||||||
|
|
||||||
for _, val in ipairs(list) do
|
|
||||||
if not seen[val] then
|
|
||||||
table.insert(result, val)
|
|
||||||
seen[val] = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
-- run if rust config true
|
-- run if rust config true
|
||||||
if pcode.active_rust_config then
|
if pcode.active_rust_config then
|
||||||
table.insert(pcode.mason_ensure_installed, "rust_analyzer")
|
table.insert(pcode.mason_ensure_installed, "rust_analyzer")
|
||||||
|
@ -76,7 +62,7 @@ if pcode.active_php_config then
|
||||||
end
|
end
|
||||||
table.insert(pcode.mason_ensure_installed, "intelephense")
|
table.insert(pcode.mason_ensure_installed, "intelephense")
|
||||||
table.insert(pcode.mason_ensure_installed, "stimulus_ls")
|
table.insert(pcode.mason_ensure_installed, "stimulus_ls")
|
||||||
table.insert(pcode.null_ls_ensure_installed, "php-cs-fixer")
|
table.insert(pcode.null_ls_ensure_installed, "phpcbf")
|
||||||
table.insert(pcode.null_ls_ensure_installed, "blade_formatter")
|
table.insert(pcode.null_ls_ensure_installed, "blade_formatter")
|
||||||
table.insert(pcode.null_ls_ensure_installed, "phpcs")
|
table.insert(pcode.null_ls_ensure_installed, "phpcs")
|
||||||
end
|
end
|
||||||
|
@ -110,11 +96,11 @@ if pcode.active_cpp_config then
|
||||||
pcode.nvim_dap = true
|
pcode.nvim_dap = true
|
||||||
end
|
end
|
||||||
-- run if java config true
|
-- run if java config true
|
||||||
-- if pcode.active_java_config.active then
|
if pcode.active_java_config.active then
|
||||||
-- table.insert(pcode.treesitter_ensure_installed, "java")
|
table.insert(pcode.treesitter_ensure_installed, "java")
|
||||||
-- table.insert(pcode.mason_ensure_installed, "jdtls")
|
table.insert(pcode.mason_ensure_installed, "jdtls")
|
||||||
-- table.insert(pcode.null_ls_ensure_installed, "google_java_format")
|
table.insert(pcode.null_ls_ensure_installed, "google_java_format")
|
||||||
-- table.insert(pcode.dap_ensure_installed, "javadbg")
|
-- table.insert(pcode.dap_ensure_installed, "javadbg")
|
||||||
-- table.insert(pcode.unregister_lsp, "jdtls")
|
-- table.insert(pcode.unregister_lsp, "jdtls")
|
||||||
-- end
|
end
|
||||||
return {}
|
return {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue