summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-07-22 03:15:43 +0200
committerGitHub <noreply@github.com>2022-07-22 03:15:43 +0200
commit11c0af44e69a165df41e5fe6681b47f4204d3623 (patch)
tree28bc4c9c6e7295996924d6b2ce8e620b2a963fa2 /doc
parentfeat: add markdownlint linter (#107) (diff)
downloadmason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar
mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.gz
mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.bz2
mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.lz
mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.xz
mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.zst
mason-11c0af44e69a165df41e5fe6681b47f4204d3623.zip
refactor!: extract mason-lspconfig to separate plugin (#109)
The rationale behind this is to make boundaries clearer as mason.nvim has no direct relation with lspconfig per se. Also, hopefully, by having it as a separate package like this would encourage more people to write similar extensions (think mason-dap and mason-null-ls). Ideally such extensions wouldn't be required at all, but there are definitely gaps to fill as of today. From now on you'll need to add `williamboman/mason-lspconfig.nvim` as a plugin if you want to use the `mason-lspconfig` extension: ```lua use { { "williamboman/mason.nvim", branch = "alpha" }, "williamboman/mason-lspconfig.nvim", "neovim/nvim-lspconfig", } ``` ```lua Plug "williamboman/mason.nvim", { 'branch': 'alpha' } Plug "williamboman/mason-lspconfig.nvim" Plug "neovim/nvim-lspconfig" ```
Diffstat (limited to 'doc')
-rw-r--r--doc/mason-lspconfig.txt206
-rw-r--r--doc/mason.txt15
2 files changed, 0 insertions, 221 deletions
diff --git a/doc/mason-lspconfig.txt b/doc/mason-lspconfig.txt
deleted file mode 100644
index 052c57ca..00000000
--- a/doc/mason-lspconfig.txt
+++ /dev/null
@@ -1,206 +0,0 @@
-*mason-lspconfig*
-
-Minimum version of neovim: 0.7.0
-
-Author: William Boman
-
-==============================================================================
-INTRODUCTION *mason-lspconfig-introduction*
-
-`mason-lspconfig` is a native extension to `mason.nvim` that ships with
-`mason.nvim`. It bridges `mason.nvim` with the `lspconfig` plugin in order to
-make it easier to use the both plugins together.
-
-It is recommended to use this extension if you use `lspconfig`.
-
-Among other things, it provides convenience APIs that allow you to use
-mason.nvim as the main control for dynamically setting up installed servers on
-an ad-hoc basis. It also provides extra commands such as `:LspInstall` that
-for example allow you to install servers for the current 'filetype'. Lastly,
-it also registers a setup hook with `lspconfig` that ensures servers installed
-with `mason.nvim` are set up with the necessary extra configuration (however,
-this only applies to a few select servers!).
-
-`lspconfig`: https://github.com/neovim/nvim-lspconfig
-
-==============================================================================
-REQUIREMENTS *mason-lspconfig-requirements*
-
-`mason-lspconfig` requires `lspconfig` to be installed. Note that `lspconfig`
-needs to be available when setting up `mason-lspconfig` - so if you lazy load
-either plugin make sure `lspconfig` is not loaded after `mason-lspconfig`.
-
-Also, make sure not to set up any servers via `lspconfig` _before_ calling
-`mason-lspconfig`'s setup function.
-
-==============================================================================
-QUICK START *mason-lspconfig-quickstart*
-
-The only thing needed to enable the `mason-lspconfig` plugin is to make sure
-to call the `setup()` function:
-
- require("mason").setup()
- require("mason-lspconfig").setup()
-
-==============================================================================
-COMMANDS *mason-lspconfig-commands*
-
- *:LspInstall*
-:LspInstall [<server>...]
-
-Installs the provided servers. This command only accepts servers that have a
-corresponding server configuration in `lspconfig`.
-
-You may also provide a language, like `:LspInstall typescript`. This will
-prompt you with a selection of all available servers for that given language.
-
-When the command is ran without any arguments, the currently active buffer's
-'filetype' will be used to identify relevant servers, and you will be prompted
-with a selection of all suggested servers.
-
- *:LspUninstall*
-:LspUninstall <server> ...
-
-Uninstalls the provided servers.
-
-==============================================================================
-SETTINGS *mason-lspconfig-settings*
-
-You can configure certain behavior of `mason-lspconfig` when calling the
-`.setup()` function.
-
-Refer to |mason-lspconfig-default-settings| for all available settings.
-
-Example:
-
- require("mason-lspconfig").setup({
- ensure_installed = { "rust_analyzer", "tsserver" }
- })
-
- *mason-lspconfig-default-settings*
-
- local DEFAULT_SETTINGS = {
- -- A list of servers to automatically install if they're not already installed. Example: { "rust-analyzer@nightly", "sumneko_lua" }
- -- This setting has no relation with the `automatic_installation` setting.
- ensure_installed = {},
-
- -- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed.
- -- This setting has no relation with the `ensure_installed` setting.
- -- Can either be:
- -- - false: Servers are not automatically installed.
- -- - true: All servers set up via lspconfig are automatically installed.
- -- - { exclude: string[] }: All servers set up via lspconfig, except the ones provided in the list, are automatically installed.
- -- Example: automatic_installation = { exclude = { "rust_analyzer", "solargraph" } }
- automatic_installation = false,
- }
-
-==============================================================================
-DYNAMIC SERVER SETUP *mason-lspconfig-dynamic-server-setup*
-
-`mason-lspconfig` provides extra opt-in functionality that allow you to set up
-LSP servers installed with `mason.nvim` without having to manually edit your
-Neovim configuration for every single server you want to use. This is also
-convenient if you want to use `mason.nvim` as the main control mechanism for
-which servers to set up. It also makes it possible to use newly installed
-servers without having to restart Neovim! Example:
-
- require("mason").setup()
- require("mason-lspconfig").setup()
- require("mason-lspconfig").setup_handlers {
- -- The first entry (without a key) will be the default handler
- -- and will be called for each installed server that doesn't have
- -- a dedicated handler.
- function (server_name) -- default handler (optional)
- require("lspconfig")[server_name].setup {}
- end,
- -- Next, you can provide targeted overrides for specific servers.
- -- For example, a handler override for the `rust_analyzer`:
- ["rust_analyzer"] = function ()
- require("rust-tools").setup {}
- end
- }
-
-Refer to |mason-lspconfig.setup_handlers()| for more information.
-
-==============================================================================
-Lua module: mason-lspconfig
-
- *mason-lspconfig.setup()*
-setup({config})
- Sets up mason with the provided {config} (see |mason-lspconfig-settings|).
-
- *mason-lspconfig.setup_handlers()*
-setup_handlers({handlers})
- Advanced feature ~
- This is an advanced, opt-in, feature that require some careful reading
- of the documentation.
-
- The recommended method to set up servers with lspconfig is to do so by
- following their guides, see |lspconfig-quickstart|.
-
- Registers the provided {handlers}, to be called by mason when an installed
- server supported by lspconfig is ready to be setup.
-
- {handlers} is a table where the keys are the name of an lspconfig server,
- and the values are the function to be called when that server is ready to
- be set up (i.e. is installed).
-
- You may also pass a default handler that will be called when no dedicated
- handler is provided. This is done by providing a function without a key
- (see example below).
-
- NOTE: ~
- The server names provided as keys are the lspconfig server names, not
- mason's package names, so for example instead of "lua-language-server"
- it's "sumneko_lua".
-
- Example: ~
-
- require("mason-lspconfig").setup_handlers({
- -- The first entry (without a key) will be the default handler
- -- and will be called for each installed server that doesn't have
- -- a dedicated handler.
- function (server_name) -- default handler (optional)
- require("lspconfig")[server_name].setup {}
- end,
- -- Next, you can provide targeted overrides for specific servers.
- ["rust_analyzer"] = function ()
- require("rust-tools").setup {}
- end,
- ["sumneko_lua"] = function ()
- lspconfig.sumneko_lua.setup {
- settings = {
- Lua = {
- diagnostics = {
- globals = { "vim" }
- }
- }
- }
- }
- end,
- })
-
- See also: ~
- You may achieve similar behaviour by manually looping through the
- installed servers (see |mason-lspconfig.get_installed_servers()|) and
- setting each one up.
-
- *mason-lspconfig.get_installed_servers()*
-get_installed_servers()
- Returns the installed LSP servers supported by lspconfig.
-
- Note that the strings returned are the lspconfig server names, not the
- mason package names. For example, "sumneko_lua" is returned instead of
- "lua-language-server". This is useful if you want to loop through the
- table and use its values to directly interact with lspconfig (for example
- setting up all installed servers).
-
- Returns: ~
- string[]
-
- See also: ~
- |mason-registry.get_installed_packages()|
- |mason-registry.get_installed_package_names()|
-
-
- vim:tw=78:ft=help:norl:expandtab:sw=4
diff --git a/doc/mason.txt b/doc/mason.txt
index 20773a2a..8dcb242a 100644
--- a/doc/mason.txt
+++ b/doc/mason.txt
@@ -22,21 +22,6 @@ API reference: ~
https://github.com/williamboman/mason.nvim/blob/alpha/doc/reference.md
==============================================================================
-EXTENSIONS *mason-extensions*
-
-
- *mason-extensions-lspconfig*
-`mason-lspconfig` is a native extension to `mason.nvim` that ships with
-`mason.nvim`. It bridges `mason.nvim` with the `lspconfig` plugin in order to
-make it easier to use the both plugins together.
-
-It is recommended to use this extension if you use `lspconfig`. To use this
-extension, make sure to set it up after `mason.nvim`, like so:
-
- require("mason").setup()
- require("mason-lspconfig").setup()
-
-==============================================================================
REQUIREMENTS *mason-requirements*
`mason.nvim` relaxes the minimum requirements by attempting multiple different