Open
Description
Description
When developing a package I prefer to use relative imports over absolute ones to avoid loop dependencies. Right now autoimport only uses absolute imports, so I need to remove the absolute reference and convert it to relative.
Possible Solution
It's not easy to solve, as we can't take into account the relative position of the file we're fixing regarding the rest of the project, as some of the tools that use autoimport (ALE for vim integration), copies the file to a temporal directory and applies the fixer there.
So we would need to:
- Deduce the location of the file regarding the package. Either by analyzing the objects of the file we're fixing and searching them in the package, or by analyzing existent relative import statements.
- Get the absolute path to the object that we need to import
- Get the relative path from the file location to the desired object