Dotfiles_nvim/lua/toolchain/init.lua

114 lines
2.5 KiB
Lua
Raw Normal View History

2024-09-07 15:55:27 +00:00
local TOOLCHAINS = {}
2024-09-07 18:39:22 +00:00
------------
-- Plugins -
------------
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
local plugins = {}
--- @param ... LazySpec
TOOLCHAINS.add_plugins = function(...)
for _, spec in ipairs({...}) do
table.insert(plugins, spec)
end
end
TOOLCHAINS.get_plugins = function()
return plugins
end
---------
-- LSPs -
---------
local lsp_autoinstalls = {}
local lsp_setups = {}
--- @param ... string
TOOLCHAINS.add_lsp_autoinstalls = function(...)
for _, lsp in ipairs({...}) do
table.insert(lsp_autoinstalls, lsp)
end
end
TOOLCHAINS.get_lsp_autoinstalls = function()
return lsp_autoinstalls
end
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
--- @param setup SetupLSPs
TOOLCHAINS.add_lsps = function(setup)
table.insert(lsp_setups, setup)
end
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
--- @param lspconfig any
--- @param capabilities any
TOOLCHAINS.setup_lsps = function(lspconfig, capabilities)
for _, setup in ipairs(lsp_setups) do
setup(lspconfig, capabilities)
end
end
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
------------
-- Null ls -
------------
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
local null_ls_setups = {}
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
--- @param setup SetupNullLsModule
TOOLCHAINS.add_null_ls_module = function(setup)
table.insert(null_ls_setups, setup)
end
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
TOOLCHAINS.get_null_ls_source = function(null_ls)
local null_ls_sources = {}
for _, setup_function in ipairs(null_ls_setups) do
local conf = setup_function(null_ls)
if #conf ~= 0 then
for _, _conf in pairs(conf) do
table.insert(null_ls_sources, _conf)
end
end
end
return null_ls_sources
end
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
----------------
-- Highlighter -
----------------
local highlighter_autoinstalls = {}
--- @param ... string
TOOLCHAINS.add_highlighter_autoinstalls = function(...)
for _, highlighter in ipairs({...}) do
table.insert(highlighter_autoinstalls, highlighter)
end
end
TOOLCHAINS.get_highlighter_autoinstalls = function()
return highlighter_autoinstalls
end
----------------
-- Init -
----------------
TOOLCHAINS.init = function()
require('toolchain.config').setup()
require('toolchain.database').setup()
require('toolchain.frontend').setup()
require('toolchain.generic').setup()
require('toolchain.git').setup()
require('toolchain.go').setup()
require('toolchain.lua').setup()
require('toolchain.php').setup()
require('toolchain.scripts').setup()
require('toolchain.text').setup()
require('toolchain.web').setup()
end
return TOOLCHAINS
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
---------------------
-- Type Definitions -
---------------------
---@alias SetupLSPs fun(lspconfig:any, capabilities: any)
---@alias SetupNullLsModule fun(null_ls: any):table