Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliSense for Search Paths doesn't work when import folder outside the workspace. #7828

Open
linette-zyy opened this issue Feb 17, 2024 · 4 comments
Assignees
Labels

Comments

@linette-zyy
Copy link

Environment
image

Steps to Reproduce

  1. Open a folder as workspace in SE.
  2. Add new python file in SE named WholsRunningMe.py.
  3. 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.
  4. Create a folder named folder1 in your local, such like : C:\Users\vyizh12\source\repos\python-azure-web-app-cookiecutter\folder1
  5. Add init.py in folder1 and type some code in __init__.py
    def FOLDER1_MSG(): print("hello world!")
  6. Add searchpaths in PythonSettings.json.
    image
  7. Type code below in WholsRunningMe.py
import folder1
folder1.FOLDER1_MSG()
  1. 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
image

@StellaHuang95
Copy link
Contributor

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.

@StellaHuang95
Copy link
Contributor

@linette-zyy How did you find PythonSettings.json in folder view? I don't see it.

@linette-zyy
Copy link
Author

@StellaHuang95
PythonSettings

@linette-zyy
Copy link
Author

This issue also repro on “Add folder to SearchPath” on today's build
image

image
No IntelliSense after add folder to SearchPath
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants