ruff server: Add tracing setup guide to Neovim documentation (#11884)

A follow-up to [this
suggestion](https://github.com/astral-sh/ruff/pull/11747#discussion_r1634297757)
on the tracing PR.

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
Jane Lewis 2024-06-18 13:39:41 -07:00 committed by GitHub
parent 2e7c3454e0
commit ff3bf583b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,3 +54,39 @@ require('lspconfig').pyright.setup {
},
}
```
By default, Ruff will not show any logs. To enable logging in Neovim, you'll need to set the `RUFF_TRACE` environment variable
to either `messages` or `verbose`:
```lua
require('lspconfig').ruff.setup {
cmd_env = { RUFF_TRACE = "messages" }
}
```
You can set the log level in `settings`:
```lua
require('lspconfig').ruff.setup {
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "debug",
}
}
}
```
It's also possible to divert Ruff's logs to a separate file with the `logFile` setting:
```lua
require('lspconfig').ruff.setup {
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "debug",
logFile = "your/log/file/path/log.txt"
}
}
}
```