mirror of https://github.com/astral-sh/ruff
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:
parent
6800a9f6f3
commit
33e14c5963
|
|
@ -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
|
[configuration](https://github.com/neovim/nvim-lspconfig#configuration) documentation, and add the
|
||||||
following to your `init.lua`:
|
following to your `init.lua`:
|
||||||
|
|
||||||
```lua
|
=== "Neovim 0.10 (with [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig))"
|
||||||
require('lspconfig').ruff.setup({
|
|
||||||
init_options = {
|
```lua
|
||||||
settings = {
|
require('lspconfig').ruff.setup({
|
||||||
-- Ruff language server settings go here
|
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
|
!!! note
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue