add: config default java

This commit is contained in:
asep.komarudin 2024-06-24 15:35:26 +07:00
parent 24b3020b5c
commit ef95246d88
5 changed files with 48 additions and 2 deletions

View file

@ -161,6 +161,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 = false, active = true,
project = "gradle", -- gradle or maven project = "gradle", -- gradle or maven
} }

View file

@ -7,4 +7,10 @@ M.list_registered = function(filetype)
return registered_providers[method] or {} return registered_providers[method] or {}
end end
M.list_registered_all = function()
local registered_providers = require("user.utils.lsp").list_all_registerd()
local method = null_ls.methods.FORMATTING
return registered_providers[method] or {}
end
return M return M

View file

@ -13,4 +13,17 @@ M.list_registered_providers_names = function(filetype)
return registered return registered
end end
M.list_all_registerd = function()
local s = require("null-ls.sources")
local available_sources = s.get_all()
local registered = {}
for _, source in ipairs(available_sources) do
for method in pairs(source.methods) do
registered[method] = registered[method] or {}
table.insert(registered[method], source.name)
end
end
return registered
end
return M return M

View file

@ -119,7 +119,7 @@ return {
local lsp_clients = lsp_format.get_format_clients({ bufnr = bufnr }) local lsp_clients = lsp_format.get_format_clients({ bufnr = bufnr })
if not vim.tbl_isempty(lsp_clients) then if not vim.tbl_isempty(lsp_clients) then
table.insert(buf_client_names, "LSP Formatter") table.insert(buf_client_names, "lsp_fmt")
end end
end end
end end

View file

@ -0,0 +1,27 @@
-- local compare = {
-- ["prettier"] = "prettier",
-- ["stylua"] = "stylua",
-- }
--
-- local 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
--
-- local formatter = require("user.utils.formatter").list_registered_all()
-- local unique_client_names = unique_list(formatter)
-- for _, value in ipairs(unique_client_names) do
-- local out = compare[value]
-- if out ~= nil then
-- print(out)
-- end
-- end