coc-python
coc-python copied to clipboard
Rename doesn't work with latest version of Rope
Rope version 0.16.0 doesn't seem to be compatible with this library. Rename works alright with Rope version 0.14.0, but I get nothing on 0.16.0.
Python: 3.7.6 Neovim 0.5.0dev Latest coc, latest coc-python
I'm experiencing the same issue too. I cannot get rename to work. I have rope 0.14.0 everywhere in my system and that doesn't work either.
See here for progress: https://github.com/python-rope/rope/issues/288
Are there any versions of Python and rope that work for renaming currently?
@jkroes my workaround (Jedi handles renaming): https://github.com/pappasam/jedi-language-server
The issue wasn't rope! I finally found the recommendation to run :checkhealth in the README. Lo and behold I had a warning about not having run npm install -g neovim. I had installed node for a different plugin, but apparently hadn't set everything up.
Edit: I spoke too soon. Extract to variable creates a new variable but ignores the new name. And that's just one broken example.
@pappasam How do you use jedi-language-server? The plugin doesn't have any instructions in the README for commands or functions to call or keybindings to press, and I couldn't pull up a help file.
@jkroes I've written a clear readme that explains how to use jedi-language-server. It also has an explicit section for configuring it with neovim and coc.
Note: jedi-language-server is NOT a Vim plugin. It's a language server. You don't install it like a vim plugin.
If you configure the server as documented here, it should work for goto definition, renaming, etc. The supported language server features are documented in the README here.
Coc requires you to bind your own key mappings to Coc's commands (which work with jedi-language-server when configured). See here for an example of how to do this.
Jedi language server is a "custom language server" that works with any LSP client (not just coc). See here for documentation about what that means and how to configure these sorts of servers with coc.
Like most non-coc-plugin language servers, there's some installation that you'll need to do yourself (jedi-language-server does not install itself on your system, you'll need to explicitly pip install it). See here for my recommended way of doing that.
jedi-language-server doesn't provide any diagnostic support. Follow the instructions in the README to get diagnostics with another plugin.
Finally, if you want to use jedi-language-server, you should uninstall coc-python. jedi-language-server is a replacement.
That said, if you want to take a stab at writing "coc-jedi-language-server", I'd be ever grateful!
I have the same issue ― none of the refactoring actions is working. For instance, after selecting a block of code/variable and selecting "Extract Variable" or "Extract Method", nothing happens.
Python: 3.7.0 vim version: NVIM v0.5.0-dev node version: v13.14.0 coc.nvim version: 0.0.78-d5471449bf coc-python version: 1.2.12 platform: linux rope: 0.17.0
Rename doesn't work too. It throws out an error
[coc.nvim] Refactor failed. Syntax error in file <node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py> line <31>: invalid syntax
[<FrameSummary file refactor.py, line 294 in watch>,
<FrameSummary file refactor.py, line 274 in _process_request>,
<FrameSummary file refactor.py, line 206 in _rename>,
<FrameSummary file refactor.py, line 117 in refactor>,
<FrameSummary file refactor.py, line 139 in onRefactor>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\refactor\rename.py, line 97 in get_changes>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\refactor\rename.py, line 195 in rename_in_module>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\refactor\occurrences.py, line 76 in find_occurrences>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\base\utils\__init__.py, line 12 in _wrapper>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\refactor\occurrences.py, line 392 in source_code>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\base\utils\__init__.py, line 12 in _wrapper>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\refactor\occurrences.py, line 412 in pymodule>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\base\project.py, line 116 in get_pymodule>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\base\pycore.py, line 142 in resource_to_pyobject>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\base\pycore.py, line 254 in get_pymodule>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\base\pyobjectsdef.py, line 162 in __init__>,
<FrameSummary file C:\Users\Ubuntu\AppData\Roaming\Python\Python38\site-packages\rope\base\pyobjectsdef.py, line 191 in _init_source>]
repo: 0.17.0 windows