PTVS
PTVS copied to clipboard
IntelliSense for Search Paths doesn't work when import folder outside the workspace.
Environment
Steps to Reproduce
- Open a folder as workspace in SE.
- Add new python file in SE named WholsRunningMe.py.
- Select a python environment from the python toolbar to open PythonSettings.json and you can check “Show All Files” on the toolbar to reveal local settings.
- Create a folder named folder1 in your local, such like : C:\Users\vyizh12\source\repos\python-azure-web-app-cookiecutter\folder1
- Add init.py in folder1 and type some code in
__init__.pydef FOLDER1_MSG(): print("hello world!") - Add searchpaths in PythonSettings.json.
- Type code below in WholsRunningMe.py
import folder1
folder1.FOLDER1_MSG()
- Make sure IntelliSense should show squiggles on the import statement
Expected behavior Make sure IntelliSense should show when import statement
Additional context and screenshots
No IntelliSense when import folder1
This also repros with project view scenarios. Adding the path to Tools -> Options -> Python -> Analysis -> Search Paths doesn't resolve the imports. Pylance logs show Info: Un-registering request handler for 3dad9764-9666-4d1e-b1c2-35f267fcf494 failed., might be an indication of what goes wrong.
I can also repro this with last pylance stable(2023.12.1), which indicates this bug is not a regression and has been there for a while.
@linette-zyy How did you find PythonSettings.json in folder view? I don't see it.
@StellaHuang95
This issue also repro on “Add folder to SearchPath” on today's build
No IntelliSense after add folder to SearchPath
On today's build
The module with green wavy lines after import.
On today's build,
After add new item "module1.py", no IntelliSence when inport