Skip to content

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

Closed

Description

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.

Activity

  1. brettcannon commented on Feb 1, 2018

    @brettcannon
    Member

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

  2. segevfiner commented on Feb 1, 2018

    @segevfiner
    Author

    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.

  3. brettcannon commented on Feb 1, 2018

    @brettcannon
    Member

    Ah, thanks for the clarification.

  4. DonJayamanne commented on May 3, 2018

    @DonJayamanne

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

  5. locked as resolved and limited conversation to collaborators on Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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