mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-24 17:58:46 +02:00
migrate config form function to global variable
This commit is contained in:
parent
b6f0601d3d
commit
38d2c29a95
24 changed files with 248 additions and 245 deletions
|
@ -9,14 +9,13 @@ local lspconfig = require("lspconfig")
|
|||
-- local servers = { "jdtls", "yamlls" }
|
||||
local servers = {}
|
||||
|
||||
local data_exists, custom_lsp = pcall(require, "custom.lsp_installer")
|
||||
local data_exists, custom_lsp = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
for _, client in pairs(custom_lsp.lspinstall) do
|
||||
for _, client in pairs(custom_lsp.lsp_installer) do
|
||||
table.insert(servers, client)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
lsp_installer.setup({
|
||||
ensure_installed = servers,
|
||||
})
|
||||
|
|
|
@ -17,17 +17,17 @@ local function idxOf(array, value)
|
|||
return nil
|
||||
end
|
||||
|
||||
local data_exists, custom_lsp = pcall(require, "custom.register_lsp")
|
||||
local data_exists, custom_lsp = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
for _, client in pairs(custom_lsp.lspreg) do
|
||||
for _, client in pairs(custom_lsp.register_lsp) do
|
||||
table.insert(servers, client)
|
||||
end
|
||||
end
|
||||
|
||||
local data_ok, unregis = pcall(require, "custom.register_lsp")
|
||||
local data_ok, unregis = pcall(require, "core.config")
|
||||
if data_ok then
|
||||
if unregis.skip_reg ~= nil then
|
||||
for _, unreg in pairs(custom_lsp.skip_reg) do
|
||||
if unregis.unregister_lsp ~= nil then
|
||||
for _, unreg in pairs(custom_lsp.unregister_lsp) do
|
||||
local my_index = idxOf(servers, unreg)
|
||||
table.remove(servers, my_index)
|
||||
end
|
||||
|
|
|
@ -12,19 +12,19 @@ local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
|||
|
||||
local sources = {}
|
||||
|
||||
local data_exists, data = pcall(require, "custom.null-ls")
|
||||
local data_exists, data = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
for _, cfg in pairs(data.sources) do
|
||||
for _, cfg in pairs(data.null_ls_sources) do
|
||||
table.insert(sources, cfg)
|
||||
end
|
||||
end
|
||||
|
||||
local run = 0
|
||||
local data_exists, frmt = pcall(require, "custom.format_onsave")
|
||||
if not data_exists then
|
||||
local ok, frmt = pcall(require, "core.config")
|
||||
if not ok then
|
||||
run = 1
|
||||
end
|
||||
if frmt.disable == 0 then
|
||||
if frmt.format_on_save == 1 then
|
||||
run = 1
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue