Extended refactoring capabilities for Python LSP Server using Rope.
This is a plugin for Python LSP Server, so you also need to have it installed.
python-lsp-server already has basic built-in support for using Rope, but it's currently limited to just renaming and completion. Installing this plugin adds more refactoring functionality to python-lsp-server.
To use this plugin, you need to install this plugin in the same virtualenv as python-lsp-server itself.
pip install pylsp-rope
Then run pylsp
as usual, the plugin will be auto-discovered by
python-lsp-server if you've installed it to the right environment. On Vim,
refer to Rope in Vim or
Neovim. For
other editors, refer to your IDE/text editor's documentation on how to setup a
language server.
There is no configuration yet.
This plugin adds the following features to python-lsp-server:
- extract method (codeAction)
- extract variable (codeAction)
- inline method/variable/parameter (codeAction)
- use function (codeAction)
- method to method object (codeAction)
- convert local variable to field (codeAction)
- organize imports (codeAction)
- more to come...
Refer to Rope documentation for more details on how these refactoring works.
This refactoring works by triggering CodeAction when selecting a block of code.
This refactoring works by triggering CodeAction when selecting a Python expression.
This refactoring works by triggering CodeAction when the cursor is on a resolvable Python identifier.
This refactoring works by triggering CodeAction when the cursor is on the
function name of a def
statement.
This refactoring works by triggering CodeAction when the cursor is on the
function name of a def
statement.
This refactoring works by triggering CodeAction when the cursor is on a local variable.
This refactoring works by triggering CodeAction anywhere.
Support for working on unsaved document is currently experimental.
This plugin is in early development, so expect some bugs. Please report in Github issue tracker if you had any issues with the plugin.
See CONTRIBUTING.md.
This package was created with Cookiecutter from lieryan/cookiecutter-pylsp-plugin project template.