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 a module fails in the conditional block when same module used in the if-statement (works for if-not) #142

Closed
DonJayamanne opened this issue Nov 14, 2017 · 5 comments
Assignees
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@DonJayamanne
Copy link

From @bgse on July 17, 2017 12:6

Environment data

VS Code version: 1.14.1 (issue also present in 1.13.x)
Python Extension version: 0.6.7
Python Version: 2.7.12
OS and version: Ubuntu 16.04

Actual behavior

Intellisense for a specific module (and only this module) fails in the conditional block after the module is used in if-statement, does work for example after module is used in if-not-statement.

Expected behavior

The intellisense for the specific module should not break down depending on how it is used in a conditional statement.

Steps to reproduce:

Try the following example code, see intellisense is broken for the 'fails' cases, and is working for the 'works' cases.

import os
import sys

if not os.path.isfile('test.txt'):
    works = os.path.isfile('test.txt')
if os.path.isfile('test.txt'):
    fails = os.path.isfile('test.txt')
    works = sys.version_info
    fails = os.path.isfile('test.txt')

if sys.version_info is not None:
    works = sys.version_info

if os.path.isfile('test.txt') is True:
    fails = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is not False:
    fails = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is not True:
    works = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is False:
    works = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is not None:
    works = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is None:
    fails = os.path.isfile('test.txt')

while os.path.isfile('test.txt'):
    works = os.path.isfile('test.txt')

while os.path.isfile('test.txt') is True:
    works = os.path.isfile('test.txt')

while os.path.isfile('test.txt') is not True:
    works = os.path.isfile('test.txt')

Copied from original issue: DonJayamanne/pythonVSCode#1090

@brettcannon brettcannon added awaiting 1-verification area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug labels Nov 14, 2017
@DonJayamanne DonJayamanne added this to the January 2018 milestone Dec 20, 2017
@MikhailArkhipov
Copy link

Minimal repro

import os

if os.path.isfile('file.txt'):
    fails = os.path.

If I delete : completion works

@DonJayamanne
Copy link
Author

Closing as upstream issue davidhalter/jedi#1025

@DonJayamanne DonJayamanne reopened this Jan 11, 2018
@DonJayamanne DonJayamanne added the meta Issue that is tracking an overall project label Jan 11, 2018
@brettcannon brettcannon removed the meta Issue that is tracking an overall project label Jan 12, 2018
@MikhailArkhipov
Copy link

Looks like jedi 0.12+

@MikhailArkhipov
Copy link

This works in VS engine

@brettcannon
Copy link
Member

Fixed thanks to the Jedi 0.12.0 upgrade.

@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

No branches or pull requests

3 participants