Environment (.env) file settings are not applied to all folders in VS Code multi-folder workspace
See original GitHub issueIssue Type: Bug
PYTHONPATH variable in .env file is not respected in all folders of a VS Code multi-folder workspace. That cause autocomplete is unable to resolve paths and add recommendations while working on files that are not in a primary workspace folder (where .code-worskpace is located).
Workspace structure (all folders are added to .code-workspace):
- folder 1 (primary)
- some python files
- .code-workspace file (sets .env file)
- .vscode/
- tasks.json, launch.json. settings.json
- .env
- folder 2:
- some python files: py1.py, py2.py, py3.py, ...
- .vscode/
- settings.json (just an example of some modified option, like max line-width)
-folder 3:
- some python files: py10.py, py11.py, py12.py, ...
I have defined PYTHONPATH to include ‘folder2’. I can import and see recomendations of a ‘folder 2’ files while I edit files in ‘folder1’, but not while I edit files in ‘folder3’. If I copy .env file and modify ‘folder3’ settings to use this file, it works.
So, question is: is this correct and expected behaviour? Are .env files, that are specified in .code-workspace meant to be used workspace-wide (eg. in all folders), or are .env files limited to a folder where .code-workspace is placed? Isn’t the whole point of multi-root workspaces to be able to use unified settings, eg. in one place (root .code-workspace)? I can execute (or use it in launch configuration) any module from another folders (folder2/3), but autocomplete does not work, which is bad. Also, have multiplied .env and other files is a bad idea - they need to be maintaned on multiple locations. Similar problem is described here.
Extension version: 2019.9.34911 VS Code version: Code 1.38.1 (b37e54c98e1a74ba89e03073e5a3761284e3ffb0, 2019-09-11T13:35:15.005Z) OS version: Windows_NT x64 10.0.17763
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i5-4570 CPU @ 3.20GHz (4 x 3193) |
GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software oop_rasterization: disabled_off protected_video_decode: unavailable_off rasterization: enabled skia_deferred_display_list: disabled_off skia_renderer: disabled_off surface_synchronization: enabled_on video_decode: enabled viz_display_compositor: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 15.89GB (7.47GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:7
Top GitHub Comments
Hi @schperplata 👋 Thank you for reaching out.
.env files specified in .code-workspace should be able to be used workspace-wide, which means that we have a bug here 🐛 I’ll add the appropriate triaging labels, thank you for reporting it!
We don’t give out ETAs, so no status. Feel free to 👍 your initial issue report to bump up its priority.
Thank you for your patience!