Skip to main content

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.

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

Configuration

There is no configuration yet.

Features

This plugin adds the following features to pylsp:

  • extract method (codeAction)
  • extract variable (codeAction)
  • inline method/variable/parameter (codeAction)
  • more to come...

Usage

Extract method

This refactoring works when selecting a block of code.

Extract variable

This refactoring works when selecting a Python expression.

Inline

This refactoring works when the cursor is on a resolvable Python identifier.

Caveat

Support for working on unsaved document is currently incomplete.

Before you start refactoring you must save all unsaved changes in your text editor. I highly recommended that you enable autosave on your text editor.

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

Developing

See CONTRIBUTING.md.

Credits

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylsp-rope-0.1.tar.gz (8.6 kB view details)

Uploaded Source

File details

Details for the file pylsp-rope-0.1.tar.gz.

File metadata

  • Download URL: pylsp-rope-0.1.tar.gz
  • Upload date:
  • Size: 8.6 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.5

File hashes

Hashes for pylsp-rope-0.1.tar.gz
Algorithm Hash digest
SHA256 29108773ae492b8346cd597e68764c099150e9e4b9f8b4c3bb7bc26536246954
MD5 ca2c5245e167f19158053f22d0144b0c
BLAKE2b-256 1841acc6529215d0232e1c4802710840161f80dc4b377bfe2411f36105b525b7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page