PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

IntelliSense does not work when changed SearchPath in PythonSettings.json file in open folder.

Open linette-zyy opened this issue 3 years ago • 5 comments

Environment image

Steps to Reproduce

  1. Open folder in SE.
  2. Add new python file in SE named module1.py
  3. 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.
  4. Create a folder named folder1 in your local ,such like : C:\Project\Temp\searchpath\folder1
  5. Add init.py in folder1 and type some code in init.py
def FOLDER1_MSG():
    print("hello world!")
  1. Add searchpaths in PythonSettings.json image
  2. Type code below in WholsRunningMe.py
import folder1
folder1.FOLDER1_MSG()
  1. IntelliSense should show squiggles on the import statement
  2. Change using the correct environment is to import a module that doesn’t exist in one of your environments a. Change SearchPaths image
  3. you should see the squiggles in WholsRunningMe.py image
  4. 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. image

linette-zyy avatar Aug 03 '21 07:08 linette-zyy

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.

rchiodo avatar Aug 20 '21 16:08 rchiodo

Whats the project root folder? C:\Project\Temp\searchpath? I think pylance only watches under root

bschnurr avatar Aug 20 '21 16:08 bschnurr

This issue also can preproduce on today's environment image

linette-zyy avatar Jan 05 '22 03:01 linette-zyy

On this environment, when changed the SearchPath, not see the squiggles in WholsRunningMe.py image image

linette-zyy avatar Jun 17 '22 04:06 linette-zyy

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.

ttSpace avatar Jan 20 '23 06:01 ttSpace