Add option for relative paths with auto-imports #2684
cdce8p
started this conversation in
Enhancement
Replies: 3 comments
-
Prior art here is TS's auto-import setting, which supports "absolute", "relative", and "auto" (whatever is shortest). |
Beta Was this translation helpful? Give feedback.
0 replies
-
Copying info from #2338 by @TheJedinator Environment data
Expected behaviourWhen instantiating or otherwise referencing a class from a different module, the auto import should be contextually aware and use relative imports.Actual behaviourAuto Import uses absolute import. LogsPython Language Server Log
Code Snippet / Additional informationXXX |
Beta Was this translation helpful? Give feedback.
0 replies
-
I do think it's worth providing a setting like TS does for this, like Jake mentioned. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Add an option to allow users to chose between absolute and relative paths for auto-imports from the same package. At the moment pylance always uses absolute paths even it the current project might prefer relative ones.
Example:
The suggestion for MyClass will be
from my_package.const import MyClass
Beta Was this translation helpful? Give feedback.
All reactions