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

VS Code adds the names of unsaved files to sys.path in the completions process #677

Closed
segevfiner opened this issue Feb 1, 2018 · 4 comments · Fixed by #1601
Closed
Assignees
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@segevfiner
Copy link

segevfiner commented Feb 1, 2018

Environment data

VS Code version: 1.19.3
Python Extension version: 0.9.1
Python Version: 2.7.12
OS and version: Ubuntu 16.04.3 x64

Actual behavior

The names of unsaved files are added to the sys.path for completion. The code that does this is:
https://github.com/Microsoft/vscode-python/blob/b09a4218f5fd2817c0f5544dce5b1e9bba72fc9d/pythonFiles/completion.py#L593-L596

Expected behavior

They should not be added.

Steps to reproduce:

  • Edit an unsaved Python file (You will have to set language mode to Python).
  • Debug the completions.py process and see that it added the "Untitled-1" name to the sys.path

Screenshot

VSCode Screenshot

P.S. Jedi takes a sys_path argument that can be used instead of munging the global sys.path of the completions process.

@brettcannon brettcannon added feature-request Request for new features or functionality area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. awaiting 1-decision labels Feb 1, 2018
@brettcannon
Copy link
Member

Can I ask why you specifically don't want unsaved files to be part of your intellisense?

@segevfiner
Copy link
Author

segevfiner commented Feb 1, 2018

That's not it... I obiously want IntelliSense to work on unsaved files. 😛

This is about their names being added to the sys.path of the completion process. Which seems unnecessary, and wrong, since they are not really files/folders on disks, yet, and Python won't be able to find any modules from such an entry. See the screenshot.

@brettcannon
Copy link
Member

Ah, thanks for the clarification.

@brettcannon brettcannon added awaiting 1-verification bug Issue identified by VS Code Team member as probable bug and removed awaiting 1-decision feature-request Request for new features or functionality labels Feb 1, 2018
@MikhailArkhipov MikhailArkhipov self-assigned this Feb 5, 2018
@DonJayamanne
Copy link

This issue has been fixed in #1471, unfortunately there's no news entry for this (was fixed while I was fixing another issue)

@DonJayamanne DonJayamanne added this to the May 2018 milestone May 3, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants