PTVS
PTVS copied to clipboard
IntelliSense does not work when changed SearchPath in PythonSettings.json file in open folder.
Environment
Steps to Reproduce
- Open folder in SE.
- Add new python file in SE named module1.py
- Select an 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:\Project\Temp\searchpath\folder1
- Add init.py in folder1 and type some code in init.py
def FOLDER1_MSG():
print("hello world!")
- Add searchpaths in PythonSettings.json
- Type code below in WholsRunningMe.py
import folder1
folder1.FOLDER1_MSG()
- IntelliSense should show squiggles on the import statement
- Change using the correct environment is to import a module that doesn’t exist in one of your environments
a. Change SearchPaths
- you should see the squiggles in WholsRunningMe.py
- Change to correct SearchPaths to make sure the squiggles go away
Expected behavior The squiggles about the import folder1 should change as the SearchPath changes.
Actual result
The squiggles did not appear when change to incorrect SearchPaths.
My guess is that we
- have a bug updating the language server settings
- this is another file that isn't watched by pylance. Not sure which.
Whats the project root folder? C:\Project\Temp\searchpath
? I think pylance only watches under root
This issue also can preproduce on today's environment
On this environment, when changed the SearchPath, not see the squiggles in WholsRunningMe.py
In today's build 17.6.0 Preview 1.0 [33319.311.main]
,Python Package: 17.0.23005.2
, The correct searchpath does not have folder1
intellisense that related to https://github.com/microsoft/PTVS/issues/6974. "IntelliSense does not work when changed SearchPath in PythonSettings.json file in open folder." This cannot repro every time, and we will continue to track this issue.