Struggled with this one for a while. If you’re going to use pyright and ruff language servers with Neovim, specifically Astronvim, add this to your astrolsp.lua file under config:

  pyright = {
    settings = {
      pyright = {
        disableOrganizeImports = true, -- Using Ruff
      },
      python = {
        analysis = {
          ignore = { '*' }, -- Using Ruff
        },
      },
    },
  }

This will allow pyright to continue autocompletion, but let’s ruff handle the formatting and linting.

More information can be found here.