-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-import? #34
Comments
@kuator, an addition in Jedi would need to be required in order to do this, there was a plan to implement a race-based completion request between Jedi and Rope, which provides auto-import and better compiled extension analysis, however it needs to be migrated to the new server |
Quoting the original Jedi author: "Jedi does not support autoimport nor will it in the near future" davidhalter/jedi-vim#736 (comment) |
I think @andfoy meant that an addition to this server is needed to support getting responses from both Jedi and Rope at the same time. |
Oh, I see, I'm sorry for misunderstanding |
As another option, try out https://github.com/deshaw/jupyterlab-pyflyby for jupyterlab auto-import |
@mlucool I mostly do backend, so I think it's a no-go for me, thanks for the reply though! |
The language server in Pyright does this, i.e. it shows auto-complete suggestions for all functions and classes from all resolved Python modules and submodules, and if you select one it adds the import automatically. Probably a good reference point if somebody decides to implement it here. |
Pyright is done in Typescript, so it doesn't offer much help to us. |
Yes, but I only meant to suggest it as a reference to learn from. Surely it must help to examine a working implementation and not have to figure out everything from scratch. |
@kuator pyflyby is pure python: https://github.com/deshaw/pyflyby (blog) |
Holy shit, that repo looks friggin awesome... If the performance is good it looks like the perfect basis for an auto import feature in a language server. Actually I could probably add a save hook to automatically add missing imports. Then I'd only be missing the auto-complete suggestions. |
Any update on this? |
https://github.com/bageljrkhanofemus/pylsp-autoimport |
Hey @bageljrkhanofemus, that's pretty cool! You could move it to this organization, so you can maintain it yourself (we wouldn't like to maintain more plugins here). |
How would I do that? |
I can send you an invite so you can you our organization. |
@bageljrkhanofemus I dunno how to use your plugin, as despite "autoimport" being installed (and works manually), and plugin is enabled in config -- no imports are suggested for missing "Path" or added automatically. Even outside virtualenv. @ccordoba12 as a general question -- how to ensure the order in which "formatting" applies? |
I think we're not ensuring any order right now. |
|
jedi doesn't support auto-import: pappasam/jedi-language-server#126 (comment)
can python-lsp support it through other means?
The text was updated successfully, but these errors were encountered: