local TOOLCHAINS = {} ------------ -- Plugins - ------------ local plugins = {} --- @param ... LazySpec function TOOLCHAINS.add_plugins(...) for _, spec in ipairs({...}) do table.insert(plugins, spec) end end function TOOLCHAINS.get_plugins() return plugins end --------- -- LSPs - --------- local lsp_autoinstalls = {} local lsp_setups = {} --- @param ... string function TOOLCHAINS.add_lsp_autoinstalls(...) for _, lsp in ipairs({...}) do table.insert(lsp_autoinstalls, lsp) end end function TOOLCHAINS.get_lsp_autoinstalls() return lsp_autoinstalls end --- @param setup SetupLSPs function TOOLCHAINS.add_lsps(setup) table.insert(lsp_setups, setup) end --- @param lspconfig any --- @param capabilities any function TOOLCHAINS.setup_lsps(lspconfig, capabilities) for _, setup in ipairs(lsp_setups) do setup(lspconfig, capabilities) end end ------------ -- Null ls - ------------ local null_ls_setups = {} --- @param setup SetupNullLsModule function TOOLCHAINS.add_null_ls_module(setup) table.insert(null_ls_setups, setup) end function TOOLCHAINS.get_null_ls_source(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 ---------------- -- Highlighter - ---------------- local highlighter_autoinstalls = {} --- @param ... string function TOOLCHAINS.add_highlighter_autoinstalls(...) for _, highlighter in ipairs({...}) do table.insert(highlighter_autoinstalls, highlighter) end end function TOOLCHAINS.get_highlighter_autoinstalls() return highlighter_autoinstalls end ---------------- -- Init - ---------------- function TOOLCHAINS.init() 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.rust').setup() require('toolchain.scripts').setup() require('toolchain.text').setup() require('toolchain.web').setup() end return TOOLCHAINS --------------------- -- Type Definitions - --------------------- ---@alias SetupLSPs fun(lspconfig:any, capabilities: any) ---@alias SetupNullLsModule fun(null_ls: any):table