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 stopped providing completions for inherited variables and methods since 2018.2.0 #1072

Closed
jsynowiec opened this issue Mar 14, 2018 · 13 comments
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@jsynowiec
Copy link

jsynowiec commented Mar 14, 2018

Environment data

  • VS Code version: 1.21.0
  • Extension version (available under the Extensions sidebar): 2018.2.1, 2018.3.1
  • OS and version: macOS 10.12.6
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7.10, 2.7.11, 2.7.14
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pyenv-virtualenv

Actual behavior

After one of the last updates of vscode-python extension, IntelliSense stopped providing completions for variables and methods inherited from parent classes and/or mixins. Completion is only provided for variables and methods declared on the derived class.

screen shot 2018-03-14 at 11 25 53

Expected behavior

Completions are available for inherited variables and methods from parent classes and mixins and from derived class.

Steps to reproduce:

  1. Select python2 as an interpreter
  2. Create a class, declare variable and/or method
  3. Create a derived class that inherits from class (1)
  4. Create an instance of derived class (2)
  5. Trigger code completion
@jsynowiec jsynowiec changed the title IntelliSense stopped providing completions from parent classes and mixins IntelliSense stopped providing completions for inherited variables and methods Mar 14, 2018
@Gr1N
Copy link

Gr1N commented Mar 14, 2018

Completion also broken in case of relative imports: from . import something show nothing.
In developer console I found same traceback as defined in issue description.

@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. needs verification labels Mar 16, 2018
@brettcannon
Copy link
Member

brettcannon commented Mar 20, 2018

I can't reproduce:
untitled

Code used to test
class FactorMixin:
    FACTOR_1 = 0.1

class Calc:
    def sum(self, a, b):
        return a + b

class BetterCalc(Calc, FactorMixin):
    def multiply_factor(self, a):
        return a * self.FACTOR_1

calc = BetterCalc()

Do you happen to have Jedi installed globally?

P.S.: That traceback doesn't really matter plus we have fixed it for 2018.3.0.

@jsynowiec
Copy link
Author

jsynowiec commented Mar 21, 2018

I can reproduce this and I'm not the only one affected. Also it's not isolated to the provided example but our primary project suddenly "lost IntelliSense" .
Two more members from my team also suddenly have the same problem after recent updates.

I don't have Jedi installed globally, nor in my virtualenv that is selected for the project.

-- Update:

I downgraded extension by manually installing 2018.1 from vsix and completion is working as expected on exactly the same project and virtualenv. There is something that causes this behaviour in 2018.2.0 and later.

2018.1.0
screen shot 2018-03-21 at 12 41 05

vs 2018.2.1
screen shot 2018-03-14 at 11 25 53

I request to reopen this issue.

cc: @DonJayamanne

@brettcannon brettcannon added info-needed Issue requires more information from poster and removed closed-invalid labels Mar 21, 2018
@brettcannon
Copy link
Member

Unfortunately without a way to reproduce the problem we can't fix it. And we can't roll back the version of Jedi as it fixed a bunch of other bugs that people were encountering. Can you upload a sample project that is triggering the problem?

@brettcannon brettcannon reopened this Mar 21, 2018
@jsynowiec
Copy link
Author

jsynowiec commented Mar 22, 2018

2018.2.0 and 2018.2.1 have this problem when I select python2 as an interpreter. Doesn't matter if it's the default macOS python2, brew installed python2 or a python2 version installed with pyenv.

I was able to reproduce on following versions:

  • 2.7.10 (macOS)
  • 2.7.11 (pyenv)
  • 2.7.14 (brew)
  • 2.7.14 (pyenv)

IntelliSense works on both 2018.2 releases when python3 (3.6.3 in my case) is selected as the project interpreter.

Can you upload a sample project that is triggering the problem?

I'm able to reproduce this without project - with a new instance of vscode, just open a new, empty file, select python syntax and paste the calculator example. It's enough to trigger the problem after selecting python2 as an interpreter.

-- Update
On python2, items returned from provideCompletionItems after triggering completion on calc. contains:

[
  {
    "kind": 2,
    "label": "multiply_factor",
    "sortText": "__multiply_factor",
  },
]

I don't know how to debug the language server part so I was able only to trace to sending commands to jediProxy.

@jsynowiec jsynowiec changed the title IntelliSense stopped providing completions for inherited variables and methods IntelliSense stopped providing completions for inherited variables and methods since 2018.2.0 Mar 22, 2018
@brettcannon brettcannon added needs verification and removed info-needed Issue requires more information from poster labels Mar 22, 2018
@NateScarlet
Copy link

NateScarlet commented Mar 27, 2018

Same issue,
I'm using python 2.7.13(pipenv), no IntelliSense for inherted mixin methods,
but it works fine when i switch to python 3.6.4.

@grechut
Copy link

grechut commented Mar 27, 2018

Same here, py2.7.11 (pyenv)

@brettcannon
Copy link
Member

So it sounds like a problem in Jedi itself that broke with the 0.11 release. Perhaps it's because you're using classic classes instead of new-style classes in Python 2 (i.e. you're not inheriting from object)?

Would someone like to file this issue upstream?

@jsynowiec
Copy link
Author

jsynowiec commented Mar 27, 2018

Perhaps it's because you're using classic classes instead of new-style classes in Python 2 (i.e. you're not inheriting from object)?

Doesn't make any difference. Checked right now with the calc example. Also, in our project all base classes and mixins do inherit from object and use the new-style classes.

Would someone like to file this issue upstream?

I think it's better if one of the vscode-python maintainers reports this issue. You know more details about which version of Jedi is embedded and how it was altered or integrated.

@brettcannon
Copy link
Member

@davidhalter is this a known regression in Jedi?

@davidhalter
Copy link

This is not a known regression. It's a bug, I can just confirm with latest Jedi master. Thanks for finding it.

@davidhalter
Copy link

Fixed on Jedi master.

@MikhailArkhipov
Copy link

#1418

@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

7 participants