Skip to content

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

@segevfiner

Description

@segevfiner

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.

Metadata

Metadata

Assignees

Labels

area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions