aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-07-15 02:25:20 +0200
committerGitHub <noreply@github.com>2022-07-15 00:25:20 +0000
commitc78df55484a8c5c1949014082f805fe99e0464c5 (patch)
treea9cd44484484c0f70b0ac87290c8e9194de6b94b /lua
parentdocs: add doc/reference.md for more advanced use cases (#75) (diff)
downloadmason-c78df55484a8c5c1949014082f805fe99e0464c5.tar
mason-c78df55484a8c5c1949014082f805fe99e0464c5.tar.gz
mason-c78df55484a8c5c1949014082f805fe99e0464c5.tar.bz2
mason-c78df55484a8c5c1949014082f805fe99e0464c5.tar.lz
mason-c78df55484a8c5c1949014082f805fe99e0464c5.tar.xz
mason-c78df55484a8c5c1949014082f805fe99e0464c5.tar.zst
mason-c78df55484a8c5c1949014082f805fe99e0464c5.zip
docs: add comment header to require("mason-lspconfig").setup_handlers() (#76)
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-lspconfig/init.lua17
1 files changed, 17 insertions, 0 deletions
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<string, fun(server_name: string)>
function M.setup_handlers(handlers)
local default_handler = Optional.of_nilable(handlers[1])