You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
allow you to (i) automatically install, and (ii) automatically enable (vim.lsp.enable()) installed servers
provide extra convenience APIs such as the :LspInstall command
provide additional LSP configurations for a few servers
translate between nvim-lspconfig server names and mason.nvim package names (e.g. lua_ls <-> lua-language-server)
Note
Since the introduction of :h vim.lsp.config in Neovim 0.11,
this plugin's feature set has been reduced. Use this plugin if you want to automatically enable installed servers
(:h vim.lsp.enable()) or have access to the :LspInstall
command.
Requirements
:h mason-lspconfig-requirements
neovim >= 0.11.0
mason.nvim >= 2.0.0
nvim-lspconfig >= 2.0.0
Installation & Usage
:h mason-lspconfig-quickstart
Install using your plugin manager of choice. Setup is required:
require("mason-lspconfig").setup()
It's important that you set up mason.nvimand have nvim-lspconfig available in :h runtimepath before setting up mason-lspconfig.nvim.
Refer to the Configuration section for information about which settings are available.
Recommended setup for lazy.nvim
The following is the recommended setup when using lazy.nvim. It will set up the plugin for you, meaning you don't have
to call require("mason-lspconfig").setup() yourself.
This will only enable servers that are installed via Mason. It will not recognize servers installed elsewhere on your
system.
Commands
:h mason-lspconfig-commands
:LspInstall [<server> ...]: Installs the provided servers. If no server is provided you will be prompted to select a
server based on the current buffer's &filetype.
:LspUninstall <server> ...: Uninstalls the provided servers.
Configuration
:h mason-lspconfig-settings
You may optionally configure certain behavior of mason-lspconfig.nvim when calling the .setup() function. Refer to
the default configuration for a list of all available settings.
localDEFAULT_SETTINGS= {
-- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "lua_ls" }---@typestring[]ensure_installed= {},
-- Whether installed servers should automatically be enabled via `:h vim.lsp.enable()`.---- To exclude certain servers from being automatically enabled:-- ```lua-- automatic_enable = {-- exclude = { "rust_analyzer", "ts_ls" }-- }-- ```---- To only enable certain servers to be automatically enabled:-- ```lua-- automatic_enable = {-- "lua_ls",-- "vimls"-- }-- ```---@typeboolean | string[] | { exclude: string[] }automatic_enable=true,
}
About
Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.