add: config global variable

This commit is contained in:
asep.komarudin 2024-05-21 14:20:50 +07:00
parent 77436b89c4
commit a7726a6b33
30 changed files with 703 additions and 857 deletions

View file

@ -9,11 +9,8 @@ local lspconfig = require("lspconfig")
-- local servers = { "jdtls", "yamlls" }
local servers = {}
local data_exists, custom_lsp = pcall(require, "core.config")
if data_exists then
for _, client in pairs(custom_lsp.lsp_installer) do
table.insert(servers, client)
end
for _, client in pairs(vim.g.pcode_lsp_installer) do
table.insert(servers, client)
end
lsp_installer.setup({

View file

@ -5,13 +5,8 @@ if not status_cmp_ok then
return
end
local lspvitualtext = false
local data_exists, lspconfig = pcall(require, "core.config")
if data_exists then
lspvitualtext = lspconfig.lsp_virtualtext
end
local icons = require("user.icons")
local lspvitualtext = vim.g.pcode_lsp_virtualtext
local icons = vim.g.pcode_icons
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem.snippetSupport = true

View file

@ -11,31 +11,18 @@ local function idxOf(array, value)
return nil
end
local data_exists, custom_lsp = pcall(require, "core.config")
if data_exists then
for _, client in pairs(custom_lsp.mason_ensure_installed) do
table.insert(servers, client)
end
for _, client in pairs(vim.g.pcode_mason_ensure_installed) do
table.insert(servers, client)
end
local unregis_lsp = {}
local data_ok, unregis = pcall(require, "core.config")
if data_ok then
if unregis.unregister_lsp ~= nil then
unregis_lsp = unregis.unregister_lsp
end
end
local icons = require("user.icons").ui
local unregis_lsp = vim.g.pcode_unregister_lsp
local icons = vim.g.pcode_icons.ui
local settings = {
ui = {
-- border = "none",
border = icons.Border,
icons = {
-- package_installed = "◍",
-- package_pending = "◍",
-- package_uninstalled = "◍",
package_pending = icons.DotCircle,
package_installed = icons.CheckCircle,
package_uninstalled = icons.BlankCircle,

View file

@ -20,12 +20,9 @@ if data_ok then
end
end
local data_exists, data = pcall(require, "core.config")
if data_exists then
-- load data null-ls
for _, nullls in pairs(data.null_ls_ensure_installed) do
table.insert(ensure_installed, nullls)
end
-- load data null-ls
for _, nullls in pairs(vim.g.pcode_null_ls_ensure_installed) do
table.insert(ensure_installed, nullls)
end
local mason_ok, mason_null_ls = pcall(require, "mason-null-ls")
@ -36,11 +33,8 @@ if mason_ok then
end
local run = 0
local ok, frmt = pcall(require, "core.config")
if not ok then
run = 1
end
if frmt.format_on_save == 1 then
local frmt = vim.g.pcode_format_on_save
if frmt == 1 then
run = 1
end