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](ac1dfbe3b6).
This commit is contained in:
Simon Sawert 2025-05-14 22:54:24 +02:00 committed by GitHub
parent 6800a9f6f3
commit 33e14c5963
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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