Skip to content

Intellisense for a module fails in the conditional block when same module used in the if-statement (works for if-not) #142

Description

From Benjamin Gerfelder (@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

Activity

MikhailArkhipov commented on Jan 9, 2018

@MikhailArkhipov

Minimal repro

import os

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

If I delete : completion works

DonJayamanne commented on Jan 11, 2018

@DonJayamanne
Author

Closing as upstream issue davidhalter/jedi#1025

MikhailArkhipov commented on Feb 13, 2018

@MikhailArkhipov

Looks like jedi 0.12+

MikhailArkhipov commented on Apr 9, 2018

@MikhailArkhipov

This works in VS engine

brettcannon commented on Apr 19, 2018

@brettcannon
Member

Fixed thanks to the Jedi 0.12.0 upgrade.

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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions