Skip to content

Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim. Strongly recommended for Windows users.

License

Notifications You must be signed in to change notification settings

ufo5260987423/mason-lspconfig.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux macOS Windows GitHub CI Sponsors

mason-lspconfig.nvim

mason-lspconfig bridges mason.nvim with the lspconfig plugin - making it easier to use both plugins together.

:help mason-lspconfig.nvim

Latest version: v1.30.0

Table of Contents

Introduction

:h mason-lspconfig-introduction

mason-lspconfig.nvim closes some gaps that exist between mason.nvim and lspconfig. Its main responsibilities are to:

  • register a setup hook with lspconfig that ensures servers installed with mason.nvim are set up with the necessary configuration
  • provide extra convenience APIs such as the :LspInstall command
  • allow you to (i) automatically install, and (ii) automatically set up a predefined list of servers
  • translate between lspconfig server names and mason.nvim package names (e.g. lua_ls <-> lua-language-server)

It is recommended to use this extension if you use mason.nvim and lspconfig (it's strongly recommended for Windows users).

Note: this plugin uses the lspconfig server names in the APIs it exposes - not mason.nvim package names. See this table for a complete mapping.

Requirements

:h mason-lspconfig-requirements

  • neovim >= 0.7.0
  • mason.nvim
  • lspconfig

Installation

use {
    "williamboman/mason.nvim",
    "williamboman/mason-lspconfig.nvim",
    "neovim/nvim-lspconfig",
}
{
    "williamboman/mason.nvim",
    "williamboman/mason-lspconfig.nvim",
    "neovim/nvim-lspconfig",
}

vim-plug

Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'

Setup

:h mason-lspconfig-quickstart

It's important that you set up the plugins in the following order:

  1. mason.nvim
  2. mason-lspconfig.nvim
  3. Setup servers via lspconfig

Pay extra attention to this if you lazy-load plugins, or somehow "chain" the loading of plugins via your plugin manager.

require("mason").setup()
require("mason-lspconfig").setup()

-- After setting up mason-lspconfig you may set up servers via lspconfig
-- require("lspconfig").lua_ls.setup {}
-- require("lspconfig").rust_analyzer.setup {}
-- ...

Refer to the Configuration section for information about which settings are available.

Automatic server setup (advanced feature)

:h mason-lspconfig-automatic-server-setup

mason-lspconfig provides extra, opt-in, functionality that allows you to automatically set up LSP servers installed via mason.nvim without having to manually add each server setup to your Neovim configuration. Refer to :h mason-lspconfig-automatic-server-setup for more details.

Commands

:h mason-lspconfig-commands

  • :LspInstall [<server>...] - installs the provided servers
  • :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.

Example:

require("mason-lspconfig").setup {
    ensure_installed = { "lua_ls", "rust_analyzer" },
}

Default configuration

local DEFAULT_SETTINGS = {
    -- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "lua_ls" }
    -- This setting has no relation with the `automatic_installation` setting.
    ---@type string[]
    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" } }
    ---@type boolean
    automatic_installation = false,

    -- See `:h mason-lspconfig.setup_handlers()`
    ---@type table<string, fun(server_name: string)>?
    handlers = nil,
}

Available LSP servers

Language Server name
1С:Enterprise bsl_ls
Ada als
Angular angularls
Ansible ansiblels
Antlers antlersls
Apex apex_ls
Arduino arduino_language_server
Assembly asm_lsp
Astro astro
AWK awk_ls
Azure Pipelines azure_pipelines_ls
Bash bashls
Bash pkgbuild_language_server
Beancount beancount
Bicep bicep
Blade stimulus_ls
BrighterScript bright_script
C# ast_grep
C# csharp_ls
C# harper_ls
C# (docs) omnisharp
C# omnisharp_mono
C++ ast_grep
C++ clangd
C++ harper_ls
Cairo cairo_ls
C ast_grep
C clangd
C harper_ls
Clarity clarity_lsp
Clojure clojure_lsp
ClojureScript clojure_lsp
CMake cmake
CMake neocmake
COBOL cobol_ls
CodeQL codeqlls
Coq coq_lsp
Crystal crystalline
CSS ast_grep
CSS css_variables
CSS cssls
CSS cssmodules_ls
CSS tailwindcss
CSS unocss
Cucumber cucumber_language_server
Cue dagger
Cypher cypher_ls
Dart ast_grep
Dhall dhall_lsp_server
Django jinja_lsp
Docker docker_compose_language_service
Docker dockerls
DOT dotls
Drools drools_lsp
D serve_d
Earthly earthlyls
Elixir elixirls
Elixir lexical
Elm elmls
Ember ember
Emmet emmet_language_server
Emmet emmet_ls
Erg erg_language_server
Erlang elp
Erlang erlangls
F# fsautocomplete
Facility Service Definition facility_language_server
Fennel fennel_language_server
Fennel fennel_ls
Flux flux_lsp
Fortran fortls
Glimmer glint
GLSL glslls
Go ast_grep
Go golangci_lint_ls
Go gopls
Go harper_ls
Go templ
Gradle gradle_ls
GraphQL graphql
Groovy groovyls
Handlebars glint
Haskell hls
Haxe haxe_language_server
Helm helm_ls
Hoon hoon_ls
HTML ast_grep
HTML html
HTML lwc_ls
HTML stimulus_ls
HTML templ
HTML twiggy_language_server
HTMX htmx
Hypr hyprls
Java ast_grep
Java java_language_server
Java jdtls
JavaScript ast_grep
JavaScript biome
JavaScript denols
JavaScript eslint
JavaScript glint
JavaScript harper_ls
JavaScript lwc_ls
JavaScript quick_lint_js
JavaScript rome
JavaScript tsserver
JavaScript vtsls
Jinja jinja_lsp
Jq jqls
JSON biome
JSON jsonls
Jsonnet jsonnet_ls
JSON rome
JSON spectral
JSX ast_grep
Julia (docs) julials
Kotlin ast_grep
Kotlin kotlin_language_server
LaTeX ltex
LaTeX texlab
LaTeX textlsp
Lelwel lelwel_ls
LESS css_variables
LESS cssls
Liquid shopify_theme_ls
Liquid theme_check
Lua ast_grep
Lua harper_ls
Lua lua_ls
Luau luau_lsp
Markdown grammarly
Markdown harper_ls
Markdown ltex
Markdown markdown_oxide
Markdown marksman
Markdown prosemd_lsp
Markdown remark_ls
Markdown vale_ls
Markdown zk
Matlab matlab_ls
MDX mdx_analyzer
Meson mesonlsp
Meson swift_mesonls
Metamath Zero mm0_ls
Motoko motoko_lsp
Move move_analyzer
Nginx nginx_language_server
Nickel nickel_ls
Nim nim_langserver
Nim nimls
Nix nil_ls
Nix rnix
Nunjucks jinja_lsp
OCaml ocamllsp
Odin ols
OneScript bsl_ls
OpenAPI vacuum
OpenCL opencl_ls
OpenFOAM foam_ls
OpenGL glsl_analyzer
OpenSCAD openscad_lsp
Org textlsp
Perl perlnavigator
Pest pest_ls
PHP intelephense
PHP phpactor
PHP psalm
PHP stimulus_ls
PICO-8 pico8_ls
PowerShell powershell_es
Prisma prismals
Protobuf bufls
Protobuf pbls
Puppet puppet
PureScript purescriptls
Python ast_grep
Python basedpyright
Python harper_ls
Python jedi_language_server
Python mutt_ls
Python (docs) pylsp
Python pylyzer
Python pyre
Python pyright
Python ruff
Python ruff_lsp
Python sourcery
Raku raku_navigator
Reason reason_ls
Rego regal
Rego regols
ReScript rescriptls
reStructuredText ltex
Robot Framework robotframework_ls
R r_language_server
Ruby harper_ls
Ruby rubocop
Ruby ruby_lsp
Ruby solargraph
Ruby sorbet
Ruby standardrb
Ruby steep
Ruby stimulus_ls
Rust ast_grep
Rust harper_ls
Rust rust_analyzer
Salt salt_ls
SCSS css_variables
SCSS cssls
SCSS somesass_ls
Slint slint_lsp
Smithy smithy_ls
Snyk snyk_ls
Solidity solang
Solidity solc
Solidity solidity
Solidity solidity_ls
Solidity solidity_ls_nomicfoundation
Sphinx esbonio
SQL sqlls
SQL sqls
Standard ML millet
Starlark bzl
Starlark starlark_rust
Starlark starpls
Stylelint stylelint_lsp
Svelte svelte
SystemVerilog hdl_checker
SystemVerilog svlangserver
SystemVerilog svls
SystemVerilog verible
Teal teal_ls
Terraform terraformls
Terraform tflint
Text grammarly
Text ltex
Text textlsp
Text vale_ls
Thrift thriftls
TOML harper_ls
TOML taplo
Twig twiggy_language_server
TypeScript ast_grep
TypeScript biome
TypeScript denols
TypeScript eslint
TypeScript glint
TypeScript harper_ls
TypeScript quick_lint_js
TypeScript rome
TypeScript tsserver
TypeScript vtsls
Typst tinymist
Typst typst_lsp
Vala vala_ls
Verilog hdl_checker
Veryl veryl_ls
VHDL hdl_checker
VHDL vhdl_ls
VimScript vimls
Visualforce visualforce_ls
Vue volar
Vue vuels
V v_analyzer
V vls
WGSL wgsl_analyzer
XML lemminx
YAML gitlab_ci_ls
YAML hydra_lsp
YAML spectral
YAML yamlls
Zig zls
- autotools_ls
- custom_elements_ls
- diagnosticls
- dprint
- efm
- typos_lsp

About

Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim. Strongly recommended for Windows users.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 96.8%
  • Vim Script 1.6%
  • Makefile 1.2%
  • Shell 0.4%