1
0
Fork 1
Dotfiles_nvim/lua/toolchain/init.lua

115 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
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.add_plugins(...)
2024-09-07 18:39:22 +00:00
for _, spec in ipairs({...}) do
table.insert(plugins, spec)
end
end
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.get_plugins()
2024-09-07 18:39:22 +00:00
return plugins
end
---------
-- LSPs -
---------
local lsp_autoinstalls = {}
local lsp_setups = {}
--- @param ... string
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.add_lsp_autoinstalls(...)
2024-09-07 18:39:22 +00:00
for _, lsp in ipairs({...}) do
table.insert(lsp_autoinstalls, lsp)
end
end
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.get_lsp_autoinstalls()
2024-09-07 18:39:22 +00:00
return lsp_autoinstalls
end
2024-09-07 15:55:27 +00:00
2024-09-07 18:39:22 +00:00
--- @param setup SetupLSPs
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.add_lsps(setup)
2024-09-07 18:39:22 +00:00
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
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.setup_lsps(lspconfig, capabilities)
2024-09-07 18:39:22 +00:00
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
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.add_null_ls_module(setup)
2024-09-07 18:39:22 +00:00
table.insert(null_ls_setups, setup)
end
2024-09-07 15:55:27 +00:00
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.get_null_ls_source(null_ls)
2024-09-07 18:39:22 +00:00
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
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.add_highlighter_autoinstalls(...)
2024-09-07 18:39:22 +00:00
for _, highlighter in ipairs({...}) do
table.insert(highlighter_autoinstalls, highlighter)
end
end
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.get_highlighter_autoinstalls()
2024-09-07 18:39:22 +00:00
return highlighter_autoinstalls
end
----------------
-- Init -
----------------
2024-09-07 23:50:39 +00:00
function TOOLCHAINS.init()
2024-09-07 18:39:22 +00:00
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()
2024-11-23 16:55:23 +00:00
require('toolchain.rust').setup()
2024-09-07 18:39:22 +00:00
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)
2024-11-23 16:55:23 +00:00
---@alias SetupNullLsModule fun(null_ls: any):table