Getting ALE/isort v5 to play nicely #3794
-
I've been using ALE for a good long time. As of isort v5, they no longer play nicely together for me. And, a year after the release, I've finally dug into what's going on to try to fix it. Given the following project structure:
where import os
import requests
from mod1 import foo WIth v4 you could run this and end up with imports that look like: cd isort-test/mod2/bar
isort baz.py import os
import requests
from mod1 import foo With v5 if you run the same command, it doesn't know what the local imports are and you get: cd isort-test/mod2/bar
isort baz.py import os
import requests
from mod1 import foo No problem. That's what the cd isort-test/mod2/bar
isort --src=../.. baz.py import os
import requests
from mod1 import foo Or alternatively, always run isort from the project root: cd isort-test/
isort mode2/bar/baz.py import os
import requests
from mod1 import foo However, I don't see a way to configure that for ALE.
The only option I can think of without modifying the fixer would be something like: let g:ale_python_isort_options='--settings-path=/Users/myself/pyproject.toml --src {something here for buffer cwd that doesn't respect the cwd change the fixer makes}' I've tried various combinations of What simple config am I missing? Or alternatively, does the fixer need to change to make the CWD change optional? I've gotten around this temporarily by manually modifying the fixer to not set the cwd in my local plugin, and adding |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you remove the cwd command does it work for you?
If it does you may want to make a PR with the change. |
Beta Was this translation helpful? Give feedback.
If you remove the cwd command does it work for you?
If it does you may want to make a PR with the change.