Skip to content

venomlab/pylsp-refactor

Repository files navigation

pylsp-refactor

Refactoring tools for Python LSP Server

This is a plugin for 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-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.

Features

This plugin adds the following features to pylsp:

Code Action:

  • introduce variable

Usage

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

Configuration

  • pylsp.plugins.pylsp_refactor.enabled is true by default, you can change it to false to disable plugin completely

Caveat

This plugin is in early development, so expect some bugs. Please report in Issue tracker if you had any issues with the plugin

Developing

See CONTRIBUTING.md

Credits

This package was created with Cookiecutter from python-lsp/cookiecutter-pylsp-plugin project template.

About

Refactoring tools for python-lsp-server

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages