https://github.com/mason-org/mason-lspconfig.nvim
Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.
https://github.com/mason-org/mason-lspconfig.nvim
hacktoberfest lsp lspconfig mason neovim nvim nvim-lspconfig
Last synced: 2 days ago
JSON representation
Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.
- Host: GitHub
- URL: https://github.com/mason-org/mason-lspconfig.nvim
- Owner: mason-org
- License: apache-2.0
- Created: 2022-07-21T11:57:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-06T23:13:03.000Z (6 days ago)
- Last Synced: 2025-05-10T17:49:58.498Z (2 days ago)
- Topics: hacktoberfest, lsp, lspconfig, mason, neovim, nvim, nvim-lspconfig
- Language: Lua
- Homepage:
- Size: 499 KB
- Stars: 3,302
- Watchers: 13
- Forks: 209
- Open Issues: 86
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README



[](https://github.com/mason-org/mason-lspconfig.nvim/actions?query=workflow%3ATests+branch%3Amain+event%3Apush)
[](https://github.com/sponsors/mason-org)# mason-lspconfig.nvim
mason-lspconfig
bridgesmason.nvim
with thelspconfig
plugin - making it easier to use both
plugins together.
:help mason-lspconfig.nvim
Latest version: v2.0.0# Table of Contents
- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Setup](#setup)
- [Automatically enable installed servers](#automatically-enable-installed-servers)
- [Commands](#commands)
- [Configuration](#configuration)
- [Default configuration](#default-configuration)# Introduction
> `:h mason-lspconfig-introduction`
This plugin's main responsibilities are to:
- 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`](https://neovim.io/doc/user/lsp.html#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()`](https://neovim.io/doc/user/lsp.html#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
## [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
"mason-org/mason.nvim",
"mason-org/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
}
```## vim-plug
```vim
Plug 'mason-org/mason.nvim'
Plug 'mason-org/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'
```# Setup
> `:h mason-lspconfig-quickstart`
It's important that you set up `mason.nvim` _and_ have `nvim-lspconfig` available in [`:h
runtimepath`](https://neovim.io/doc/user/options.html#'runtimepath') before setting up `mason-lspconfig.nvim`.Refer to the [Configuration](#configuration) section for information about which settings are available.
# Automatically enable installed servers
`mason-lspconfig.nvim` will automatically enable (`vim.lsp.enable()`) installed servers for you by default.
To disable this feature:
```lua
require("mason-lspconfig").setup {
automatic_enable = false
}
```To exclude certain servers from being enabled:
```lua
require("mason-lspconfig").setup {
automatic_enable = {
exclude = {
"rust_analyzer",
"ts_ls"
}
}
}
```Alternatively, to only enable specific servers:
```lua
require("mason-lspconfig").setup {
automatic_enable = {
"lua_ls",
"vimls"
}
}
```> [!NOTE]
> 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 [ ...]`: 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 ...`: 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](#default-configuration) for a list of all available settings.Example:
```lua
require("mason-lspconfig").setup {
ensure_installed = { "lua_ls", "rust_analyzer" },
}
```## Default configuration
```lua
local DEFAULT_SETTINGS = {
-- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "lua_ls" }
---@type string[]
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"
-- }
-- ```
---@type boolean | string[] | { exclude: string[] }
automatic_enable = true,
}
```