diff options
| author | William Boman <william@redwill.se> | 2025-05-19 08:12:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-19 08:12:16 +0200 |
| commit | 20a9c13b689f9fa869c0eab5e33c6db529de3813 (patch) | |
| tree | 15cb46b7ecd764d209f272fe982dccf9c497e497 | |
| parent | fix: remove omnisharp configuration (#556) (diff) | |
| download | mason-lspconfig-20a9c13b689f9fa869c0eab5e33c6db529de3813.tar mason-lspconfig-20a9c13b689f9fa869c0eab5e33c6db529de3813.tar.gz mason-lspconfig-20a9c13b689f9fa869c0eab5e33c6db529de3813.tar.bz2 mason-lspconfig-20a9c13b689f9fa869c0eab5e33c6db529de3813.tar.lz mason-lspconfig-20a9c13b689f9fa869c0eab5e33c6db529de3813.tar.xz mason-lspconfig-20a9c13b689f9fa869c0eab5e33c6db529de3813.tar.zst mason-lspconfig-20a9c13b689f9fa869c0eab5e33c6db529de3813.zip | |
docs: update installation & setup section, add lazy.nvim examples (#557)
| -rw-r--r-- | README.md | 76 | ||||
| -rw-r--r-- | doc/mason-lspconfig.txt | 7 |
2 files changed, 50 insertions, 33 deletions
@@ -4,7 +4,7 @@ [](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 +<h1 align="center">mason-lspconfig.nvim</h1> <p align="center"> <code>mason-lspconfig</code> bridges <a @@ -19,18 +19,18 @@ <sup>Latest version: v2.0.0</sup> <!-- x-release-please-version --> </p> -# Table of Contents +## Table of Contents - [Introduction](#introduction) - [Requirements](#requirements) -- [Installation](#installation) -- [Setup](#setup) +- [Installation & Usage](#installation--usage) + - [Recommended setup for `lazy.nvim`](#recommended-setup-for-lazynvim) - [Automatically enable installed servers](#automatically-enable-installed-servers) - [Commands](#commands) - [Configuration](#configuration) - [Default configuration](#default-configuration) -# Introduction +## Introduction > `:h mason-lspconfig-introduction` @@ -47,7 +47,7 @@ This plugin's main responsibilities are to: > ([`:h vim.lsp.enable()`](https://neovim.io/doc/user/lsp.html#vim.lsp.enable())) or have access to the `:LspInstall` > command. -# Requirements +## Requirements > `:h mason-lspconfig-requirements` @@ -55,36 +55,38 @@ This plugin's main responsibilities are to: - `mason.nvim >= 2.0.0` - `nvim-lspconfig >= 2.0.0` -# Installation +## Installation & Usage -## [lazy.nvim](https://github.com/folke/lazy.nvim) - -```lua -{ - "mason-org/mason.nvim", - "mason-org/mason-lspconfig.nvim", - "neovim/nvim-lspconfig", -} -``` +> `:h mason-lspconfig-quickstart` -## vim-plug +Install using your plugin manager of choice. **Setup is required**: -```vim -Plug 'mason-org/mason.nvim' -Plug 'mason-org/mason-lspconfig.nvim' -Plug 'neovim/nvim-lspconfig' +```lua +require("mason-lspconfig").setup() ``` -# 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 +### 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**. + +```lua +{ + "mason-org/mason-lspconfig.nvim", + opts = {}, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, +} +``` + +## Automatically enable installed servers `mason-lspconfig.nvim` will automatically enable (`vim.lsp.enable()`) installed servers for you by default. @@ -124,7 +126,7 @@ require("mason-lspconfig").setup { > This will only enable servers that are installed via Mason. It will not recognize servers installed elsewhere on your > system. -# Commands +## Commands > `:h mason-lspconfig-commands` @@ -132,7 +134,7 @@ require("mason-lspconfig").setup { server based on the current buffer's `&filetype`. - `:LspUninstall <server> ...`: Uninstalls the provided servers. -# Configuration +## Configuration > `:h mason-lspconfig-settings` @@ -147,7 +149,23 @@ require("mason-lspconfig").setup { } ``` -## Default configuration +### Configuration using `lazy.nvim` + +```lua +{ + "mason-org/mason-lspconfig.nvim", + opts = { + ensure_installed = { "lua_ls", "rust_analyzer" }, + }, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, +} +``` + + +### Default configuration ```lua local DEFAULT_SETTINGS = { diff --git a/doc/mason-lspconfig.txt b/doc/mason-lspconfig.txt index b30983a..2efb818 100644 --- a/doc/mason-lspconfig.txt +++ b/doc/mason-lspconfig.txt @@ -48,11 +48,10 @@ Refer to |mason-lspconfig-settings| for available settings. ----------------- Setting up servers -Next, you're ready to set up the servers you want to use. Refer to lspconfig's -documentation |lspconfig-quickstart| for more information on how to do so! +`mason-lspconfig.nvim` will automatically enable (|vim.lsp.enable()|) +installed servers for you by default, see |mason-automatic-enable|. -`mason-lspconfig.nvim` will automatically enable (|vim.lsp.enable()|) installed -servers for you by default, see |mason-automatic-enable|. +Refer to |lsp-quickstart| for information on how to configure servers. ----------------- Installation of servers |
