Skip to content

Commit

Permalink
Update Neovim documentation (#385)
Browse files Browse the repository at this point in the history
## Summary

Update Neovim documentation with the following changes:
- Fix the code to disable hover capability. Earlier, it would disable
for _every_ language server while we only want to disable it for
`ruff-lsp`.
- Add an example to disable diagnostics and import sorting from Pyright.

fixes: #384
  • Loading branch information
dhruvmanila committed Feb 13, 2024
1 parent 4afe879 commit bae2b24
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,38 @@ LSP for certain capabilities, like `textDocument/hover`:

```lua
local on_attach = function(client, bufnr)
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
if client.name == 'ruff_lsp' then
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end
end

require('lspconfig').ruff_lsp.setup {
on_attach = on_attach,
}
```

And, if you'd like to use Ruff exclusively for linting, formatting, and organizing imports, you can
disable those capabilities in Pyright:

```lua
require('lspconfig').pyright.setup {
on_attach = on_attach,
settings = {
pyright = {
-- Using Ruff's import organizer
disableOrganizeImports = true,
},
python = {
analysis = {
-- Ignore all files for analysis to exclusively use Ruff for linting
ignore = { '*' },
},
},
},
}
```

Ruff also integrates with [`coc.nvim`](https://github.com/neoclide/coc.nvim/wiki/Language-servers#using-ruff-lsp):

```json
Expand Down

0 comments on commit bae2b24

Please sign in to comment.