mirror of https://github.com/astral-sh/ruff
For neovim:null_ls use ruff builtin for formatting (#2386)
null_ls picked up the recommended snippet in README.md and ruff formatting now a builtin. Ref: 1.482990e3912.7b2b28e207/doc/BUILTINS.md (ruff-1)
This commit is contained in:
parent
1b0748d19d
commit
da4618d77b
22
README.md
22
README.md
|
|
@ -1541,30 +1541,10 @@ tools:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
local methods = require("null-ls.methods")
|
|
||||||
local helpers = require("null-ls.helpers")
|
|
||||||
|
|
||||||
local function ruff_fix()
|
|
||||||
return helpers.make_builtin({
|
|
||||||
name = "ruff",
|
|
||||||
meta = {
|
|
||||||
url = "https://github.com/charliermarsh/ruff/",
|
|
||||||
description = "An extremely fast Python linter, written in Rust.",
|
|
||||||
},
|
|
||||||
method = methods.internal.FORMATTING,
|
|
||||||
filetypes = { "python" },
|
|
||||||
generator_opts = {
|
|
||||||
command = "ruff",
|
|
||||||
args = { "--fix", "-e", "-n", "--stdin-filename", "$FILENAME", "-" },
|
|
||||||
to_stdin = true
|
|
||||||
},
|
|
||||||
factory = helpers.formatter_factory
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = {
|
sources = {
|
||||||
ruff_fix(),
|
null_ls.builtins.formatting.ruff,
|
||||||
null_ls.builtins.diagnostics.ruff,
|
null_ls.builtins.diagnostics.ruff,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue