From c78df55484a8c5c1949014082f805fe99e0464c5 Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 15 Jul 2022 02:25:20 +0200 Subject: docs: add comment header to require("mason-lspconfig").setup_handlers() (#76) --- lua/mason-lspconfig/init.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lua') diff --git a/lua/mason-lspconfig/init.lua b/lua/mason-lspconfig/init.lua index 8682d2e8..276d41c4 100644 --- a/lua/mason-lspconfig/init.lua +++ b/lua/mason-lspconfig/init.lua @@ -107,6 +107,23 @@ function M.setup(config) require "mason-lspconfig.api.command" end +---Register handlers that will be called when a server is ready to be set up (i.e. is installed). +---When this function is first called, the appropriate handler will be called for each installed server. +---When a new server is installed, the appropriate handler for that server will be called (this allows you for example to set up-new servers without restarting Neovim). +---The default handler is provided as the first value in the table argument. +--- +---Example: +---```lua +--- require("mason-lspconfig").setup_handlers { +--- function (server_name) +--- -- default handler +--- require("lspconfig")[server_name].setup {} +--- end, +--- ["rust_analyzer"] = function () +--- require("rust-tools").setup {} +--- end +--- } +---``` ---@param handlers table function M.setup_handlers(handlers) local default_handler = Optional.of_nilable(handlers[1]) -- cgit v1.2.3-70-g09d2