Environment data
- VS Code version: 1.32.3 (have also seen this on older versions)
- Extension version: 2019.2.5558 (have also seen this on older versions)
- OS and version: Ubuntu 16.04.6
- Python version: 3.5.2 (have also seen this on other versions)
- Type of virtual environment used: venv
- Relevant/affected Python packages and their versions: I currently have isort 4.3.15, though I've seen this on older versions
Expected behaviour
That when running the "Sort Imports" command on a file, the imports are sorted according to my setup.cfg config regardless of whether the file is currently saved or not.
Actual behaviour
When running the "Sort Imports" command on a file:
- If the file is saved, my
setup.cfg config is respected
- If the file has modifications, my
setup.cfg config is not respected
Steps to reproduce:
Given this config:
# setup.cfg
[isort]
length_sort = True
# demo.py
import os
import logging
import collections
- put
setup.cfg and demo.py next to each other in a new folder
- open that folder as a workspace in VSCode
- open
demo.py
- "Sort imports" within
demo.py, it should be unchanged
- edit
demo.py, without saving it
- "Sort imports" within
demo.py, note that its imports have changed ordering to ignore the length_sort option
This reproduces with much more complex configs, and other options are also ignored, so I strongly suspect the setup.cfg file isn't being picked up as a whole if the file is modified.
Environment data
Expected behaviour
That when running the "Sort Imports" command on a file, the imports are sorted according to my
setup.cfgconfig regardless of whether the file is currently saved or not.Actual behaviour
When running the "Sort Imports" command on a file:
setup.cfgconfig is respectedsetup.cfgconfig is not respectedSteps to reproduce:
Given this config:
setup.cfganddemo.pynext to each other in a new folderdemo.pydemo.py, it should be unchangeddemo.py, without saving itdemo.py, note that its imports have changed ordering to ignore thelength_sortoptionThis reproduces with much more complex configs, and other options are also ignored, so I strongly suspect the
setup.cfgfile isn't being picked up as a whole if the file is modified.