You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
648 B

  1. local lsp_installer_servers = require "nvim-lsp-installer.servers"
  2. local utils = require "utils"
  3. local M = {}
  4. function M.setup(servers, options)
  5. for server_name, _ in pairs(servers) do
  6. local server_available, server = lsp_installer_servers.get_server(server_name)
  7. if server_available then
  8. server:on_ready(function()
  9. local opts = vim.tbl_deep_extend("force", options, servers[server.name] or {})
  10. server:setup(opts)
  11. end)
  12. if not server:is_installed() then
  13. utils.info("Installing " .. server.name)
  14. server:install()
  15. end
  16. else
  17. utils.error(server)
  18. end
  19. end
  20. end
  21. return M