isort
no longer picks up settings from pyproject.toml
when it is not in the workspace root folder
#20205
Labels
triage-needed
Needs assignment to the proper sub-team
Type: Bug
Behaviour
Expected vs. Actual
An important feature when using
isort
(i.e. organized imports via"editor.codeActionsOnSave": { "source.organizeImports": true }
) is that it picks up its configuration for the underlyingpyproject.toml
.If that doesn't work, the formatting one gets in the IDE is not in line with what one gets from running
isort
manually in the command line, which causes discrepancies in the source code.In previous versions of the plugin / VSCode this seems to have worked fine, but with the update to VSCode 1.7.3 the behavior broke.
It still works if the
pyproject.toml
is exactly in the VSCode workspace root folder. However, when openen VSCode in a parent folder,isort
no longer seems to pick up thepyproject.toml
config.Steps to reproduce:
with file contents:
<some-temp-dir>/py_project_root/demo.py
<some-temp-dir>/py_project_root/pyproject.toml
settings.json
enables form on save with organize imports:Open
code
in<some-temp-dir>
, i.e., one level up compared to where thepyproject.toml
is.Modify the
demo.py
slightly and pressCTRL
+S
.Actual behavior: The editor view briefly "jumps" because
isort
is applied without the proper config applied. A fraction of a second laterblack
gets applied that fixes the formatting back to what it should be.Expected behavior:
isort
should pick up the proper config, which implies running in "black" profile, which avoids the flicker.Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2022.18.2
VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T04:27:29.066Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No
Remote OS version: Linux x64 5.4.0-124-generic
Remote OS version: Linux x64 5.4.0-124-generic
Remote OS version: Linux x64 5.4.0-124-generic
Remote OS version: Linux x64 5.4.0-124-generic
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: