Extended refactoring capabilities for Python LSP Server using Rope.
Project description
pylsp-rope
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.
Installation
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.
Configuration
There is no configuration yet.
Features
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.
Usage
Extract method
This refactoring works by triggering CodeAction when selecting a block of code.
Extract variable
This refactoring works by triggering CodeAction when selecting a Python expression.
Inline
This refactoring works by triggering CodeAction when the cursor is on a resolvable Python identifier.
Use function
This refactoring works by triggering CodeAction when the cursor is on the
function name of a def
statement.
Method to method object
This refactoring works by triggering CodeAction when the cursor is on the
function name of a def
statement.
Convert local variable to field
This refactoring works by triggering CodeAction when the cursor is on a local variable.
Organize import
This refactoring works by triggering CodeAction anywhere.
Caveat
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.
Developing
See CONTRIBUTING.md.
Credits
This package was created with Cookiecutter from lieryan/cookiecutter-pylsp-plugin project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pylsp-rope-0.1.7.tar.gz
.
File metadata
- Download URL: pylsp-rope-0.1.7.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e80b8422dee114b49ec15e00749cca33a9b7ade56ca781802a85409e6c4b08 |
|
MD5 | 00c4d031e4d4b165e69ab0d05230542d |
|
BLAKE2b-256 | 658d266546de5f0165f26d9371a2ea77a3ea83cdcb488f891830123e253b9d44 |
File details
Details for the file pylsp_rope-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: pylsp_rope-0.1.7-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f704916a5bbaa0eef89353822b048336d8889d8fa4e6566786ab136c05c76eb0 |
|
MD5 | b8171671f10a9130cd9d76386cdffc21 |
|
BLAKE2b-256 | a721d0c6ed20c4c1ac7e9ca918a2582e0a7f0f844c6562cb40aea2f2a766bc87 |