Autocomplete imports from subdirectories #18614
-
Hi folks, Is it currently possible to get autocompleted symbols to generate correct import statements for a package in a subdirectory of a monorepo? By a monorepo, I mean any project which has one (or more) Python packages not at root level. I.e. the directory structure resembles this:
If I import I've seen this Stack Overflow answer, but adding my package directories to Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
For this sort of structure you typically set up a multi-root workspace where you treat each subdirectory as separate workspaces. But even then I don't think you would get what you're after in terms of inserting automatic imports. Could you open an issue at https://github.com/microsoft/pylance-release ? |
Beta Was this translation helpful? Give feedback.
-
Oh my gosh... this problem fixed itself. After restarting VSCode, this line was automatically added to my settings: "python.analysis.extraPaths": ["./backend"] When I have both this and |
Beta Was this translation helpful? Give feedback.
Oh my gosh... this problem fixed itself. After restarting VSCode, this line was automatically added to my settings:
When I have both this and
"python.autoComplete.extraPaths": ["./backend"]
set, imports work exactly as I want them to.