I'm using the vscode extension importmagic which works fine when not working in a remote container. In the remote container I don't see my own classes and functions as suggestions for autocomplete.
I've tried adding
"python.autoComplete.extraPaths": [
"${workspaceFolder}",
],
to the settings in devcontainer.json where workspaceFolder=/app. If I set it to ${workspaceFolder}/module it gives me suggestions for the underlying modules.
For example I have a structure like module/sub_module/sub_sub_module and it will suggest and add import automatically like from sub_module.sub_sub_module import ... but module is not included in the import so the import can't be resolved.
Is there a setting that I'm missing or why can't it detect underlying module when using only workspaceFolder as extraPaths?
Change the Python-Server in settings.json from "Pylance" or "Microsoft" or whatever you are using- to "Jedi"
"python.languageServer": "Jedi"
To be honest, no solutions worked for me except this one.
One of the solution is keep adding all the paths to extraPaths which doesn't sound good. Instead use "Jedi" server. No need to add any extraPaths, it uses the directory of open files and folders for autocomplete and analysis by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With