Option to set project root for auto-import suggestions when workspace is opened at subfolder level #7533
Replies: 5 comments 1 reply
-
|
Hi @roberfi, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime. Similar Issues (FYI only, not solutions) The following issues may or may not be related to your report. They are provided for reference only, as they may describe similar symptoms, affect the same feature, or address related concerns, but may not be the same issue.
The team will respond to your issue shortly. Please note this is a trial feature and may not be fully accurate. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or was incorrect, please give it a 👎. Your feedback helps us improve! |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the idea. I believe you're asking for some way of specifying what the 'real' project root is? Or maybe as an alternative, we just make Pylance fast enough when opening the real project root. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, I would like to specify where the real project root is located. |
Beta Was this translation helpful? Give feedback.
-
|
Converted to a discussion item for up votes. |
Beta Was this translation helpful? Give feedback.
-
|
any news? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When working with a Python project where I have the workspace root set to a subfolder, VS Code's Python extension doesn't correctly handle auto-import suggestions for modules that should be imported relative to the actual project root and I don't see any way to configure it properly.
Project Structure
Expected Behavior
Auto-import should suggest imports like:
Actual Behavior
Auto-import suggests imports like:
Settings Attempted
{ "python.analysis.extraPaths": ["${workspaceFolder}/.."], "python.analysis.autoSearchPaths": true, "python.analysis.include": ["${workspaceFolder}/.."], "python.defaultInterpreterPath": "../.venv/bin/python" }Use Case
This is common in large projects where developers work primarily in sub-directories but need proper import resolution relative to the project root. Opening the parent directory as workspace root significantly impacts performance in large codebases.
Environment
VS Code version: 1.103.1
Python extension version: 2025.12.0
OS: Ubuntu 24.04
Beta Was this translation helpful? Give feedback.
All reactions