Refactoring tools for Python LSP Server
This is a plugin for 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-refactor
Then run python-lsp-server
as usual, the plugin will be auto-discovered by
python-lsp-server
if you've installed it to the right environment. Refer to
python-lsp-server
and your IDE/text editor documentation on how to setup
python-lsp-server
.
This plugin adds the following features to pylsp
:
Code Action:
- introduce variable
When CodeAction is triggered and the cursor is on a line where function call or class instantiation is presented. Makes a new variable from a function call or class instantiation and tries to guess a name for it if possible.
Additionally, it moves newly created variable out of block if it's happening somewhere inside dict initialization or class instantiation
pylsp.plugins.pylsp_refactor.enabled
istrue
by default, you can change it to false to disable plugin completely
This plugin is in early development, so expect some bugs. Please report in Issue tracker if you had any issues with the plugin
See CONTRIBUTING.md
This package was created with Cookiecutter from python-lsp/cookiecutter-pylsp-plugin project template.