F12 VSCode (Go To Definition) pointing to the wrong module
Question:
I have a scenario with a Python project that has 2 similar modules (same name and same structure).
I make sure that the PYTHONPATH has the right order of imports so that it has the behavior I expect.
But the F12 Go To Definition function within VSCode does not follow that pattern and goes to the definition in the wrong module/folder.
How can I make sure GTD follows the order in the PYTHONPATH? Or at least force it to go to the folder I want?
Answers:
For future reference – thanks to user for the comment – setting the below variables in my settings.json helped solve the issue:
"python.autoComplete.extraPaths": [your_folder],
"python.analysis.extraPaths": [your_folder],
"python.analysis.include": [your_folder],
"python.analysis.exclude": [some_other_folder],
I have a scenario with a Python project that has 2 similar modules (same name and same structure).
I make sure that the PYTHONPATH has the right order of imports so that it has the behavior I expect.
But the F12 Go To Definition function within VSCode does not follow that pattern and goes to the definition in the wrong module/folder.
How can I make sure GTD follows the order in the PYTHONPATH? Or at least force it to go to the folder I want?
For future reference – thanks to user for the comment – setting the below variables in my settings.json helped solve the issue:
"python.autoComplete.extraPaths": [your_folder],
"python.analysis.extraPaths": [your_folder],
"python.analysis.include": [your_folder],
"python.analysis.exclude": [some_other_folder],