nvim/lua/config/lsp/ruff.lua

29 lines
615 B
Lua
Raw Normal View History

2025-01-13 14:06:38 +01:00
local bin_name = "ruff"
local cmd = { bin_name, "server", }
local root_files = {
"pyproject.toml",
"requirements.txt",
".git",
}
vim.api.nvim_create_autocmd("FileType", {
pattern = "python",
callback = function()
vim.lsp.start({
name = "ruff-server",
cmd = cmd,
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
settings = {
},
})
2025-02-07 14:59:55 +01:00
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- pattern = { "*.py", "*.pyi" },
-- callback = function()
-- vim.lsp.buf.format { timeout_ms = 2000 }
-- end,
-- })
2025-01-13 14:06:38 +01:00
end,
})