From 33e14c5963d620550b45e99c3653b9d4e7a28378 Mon Sep 17 00:00:00 2001 From: Simon Sawert Date: Wed, 14 May 2025 22:54:24 +0200 Subject: [PATCH] Update Neovim setup docs (#18108) ## Summary Nvim 0.11+ uses the builtin `vim.lsp.enable` and `vim.lsp.config` to enable and configure LSP clients. This adds the new non legacy way of configuring Nvim with `nvim-lspconfig` according to the upstream documentation. Update documentation for Nvim LSP configuration according to `nvim-lspconfig` and Nvim 0.11+ ## Test Plan Tested locally on macOS with Nvim 0.11.1 and `nvim-lspconfig` master/[ac1dfbe](https://github.com/neovim/nvim-lspconfig/tree/ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57). --- docs/editors/setup.md | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/docs/editors/setup.md b/docs/editors/setup.md index 0603a6b029..507e9d450c 100644 --- a/docs/editors/setup.md +++ b/docs/editors/setup.md @@ -36,15 +36,31 @@ Ruff Language Server in Neovim. To set it up, install [configuration](https://github.com/neovim/nvim-lspconfig#configuration) documentation, and add the following to your `init.lua`: -```lua -require('lspconfig').ruff.setup({ - init_options = { - settings = { - -- Ruff language server settings go here - } - } -}) -``` +=== "Neovim 0.10 (with [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig))" + + ```lua + require('lspconfig').ruff.setup({ + init_options = { + settings = { + -- Ruff language server settings go here + } + } + }) + ``` + +=== "Neovim 0.11+ (with [`vim.lsp.config`](https://neovim.io/doc/user/lsp.html#vim.lsp.config()))" + + ```lua + vim.lsp.config('ruff', { + init_options = { + settings = { + -- Ruff language server settings go here + } + } + }) + + vim.lsp.enable('ruff') + ``` !!! note