astral-sh/ruff-lsp

Setting the ruff configs directly in Neovim configs rather than `toml` file

ChengAoShen opened this issue · 2 comments

Hello, I'm glad to use such a great and fast Python LSP! I feel a little confused about whether I can set the ruff configs directly in the neovim configs when I set up it such as :

require("lspconfig").ruff_lsp.setup({
    settings = {},
})

just like pylsp does.

require("lspconfig").pylsp.setup({
    settings = {
        pylsp = {
            configurationSources = { "flake8", "pycodestyle" },
        }
    }
}

Or must I create the toml file for each Python project?

@ChengAoShen Here is an example config

lspconfig.ruff_lsp.setup {
  on_attach = on_attach,
  capabilities = capabilities,
  filetypes = { "python" },
  init_options = {
    settings = {
      -- Any extra CLI arguments for `ruff` go here.
      lint = {
        args = {
          "--select=ARG,F,E,I001",
          "--line-length=88",
        },
      },
    },
  },
}

Oh, great! Thanks for your kind answer.