python-rope / ropevim

vim mode that uses rope library to provide features like python refactorings and code-assists
GNU General Public License v2.0
245 stars 34 forks source link

Cannot setup for Neovim using lazy.nvim #101

Open dimtsi opened 4 months ago

dimtsi commented 4 months ago

After some attempts I do not seem to be able to setup ropevim in my Neovim setup(NvChad) which uses lazyvim plugin manager.

I am using python-language-server (pylsp) LSP installed via Mason. I have installed the following libraries both in the default conda environment that is activated in the shell when I start nvim and the python-language-server virtual environment.

rope
ropevim
pynvim
ropemode

In my plugins.lua I have added the following

  {
    "python-rope/ropevim",
    ft = "python",
    init = function() vim.g.ropevim_prefer_py3 = 1 end,
    build = "pip install rope ropevim pynvim",
    lazy = false
  },

and the following to configs/lspconfig.lua

lspconfig.pylsp.setup {
  on_attach = on_attach,
  settings = {
    pylsp = {
      plugins = {
        -- formatter options
        black = { enabled = true },
        autopep8 = { enabled = false },
        yapf = { enabled = false },
        -- linter options
        pylint = { enabled = false, executable = "pylint" },
        pyflakes = { enabled = false },
        pycodestyle = { enabled = false },
        -- type checker
        pylsp_mypy = { enabled = true },
        -- auto-completion options
        jedi_completion = { fuzzy = true },
        -- import sorting
        pyls_isort = { enabled = true },
      },
    },
  },
  flags = {
    debounce_text_changes = 200,
  },
  capabilities = capabilities,
  filetypes = {"python"}
}

Having done all of that I do not get access to ropevim commands :Rope* or keybindings. The interesting thing is that when I press :h Rope<TAB> I see the ropevim docs which is interesting. Am I missing something? And if it matters can you maybe explain how it should be installed using a lazy.nvim setup?

Note: I am using an NvChad setup so I am more interested in why the commands are not loaded and not the keybindings as some of them can already be overridden.

lieryan commented 4 months ago

Hi @dimtsi, ropevim is in maintenance only mode. The current recommended way to use rope within vim is to use python-lsp-server with an LSP client. pylsp comes with builtin support for rope via the built-in plugin rope_rename, rope_autoimport, and rope_completion and pylsp-rope adds refactoring codeactions.

You should be able to use any LSP client of choice (I use vim-lsp, but I occasionally test on other LSP client as well). If you're using neovim though and want codeaction support, I would recommend against using the builtin LSP client, because IME neovim's default lsp is quite buggy when handling CodeActions.