Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Latest commit

 

History

History
25 lines (16 loc) · 1.03 KB

autoimport.md

File metadata and controls

25 lines (16 loc) · 1.03 KB

Autoimport for pylsp

Requirements:

  1. install python-lsp-server[rope]
  2. set pylsp.plugins.rope_autoimport.enabled to true

Startup

Autoimport will generate an autoimport sqllite3 database in .ropefolder/autoimport.db on startup.
This will take a few seconds but should be much quicker on future runs.

Usage

Autoimport will provide suggestions to import names from everything in sys.path. You can change this by changing where pylsp is running or by setting rope's 'python_path' option. It will suggest modules, submodules, keywords, functions, and classes.

Since autoimport inserts everything towards the end of the import group, its recommended you use the isort plugin.

Credits

  • Most of the code was written by me, @bagel897
  • lyz-code for inspiration and some ideas
  • rope, especially @lieryan
  • pyright for details on language server implementation