Skip to content

IntelliSense stopped providing completions for inherited variables and methods since 2018.2.0 #1072

Closed

Description

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

Activity

  1. changed the title [-]IntelliSense stopped providing completions from parent classes and mixins[/-] [+]IntelliSense stopped providing completions for inherited variables and methods[/+] on Mar 14, 2018
  2. Gr1N commented on Mar 14, 2018

    @Gr1N

    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.

  3. brettcannon commented on Mar 20, 2018

    @brettcannon
    Member

    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.

  4. jsynowiec commented on Mar 21, 2018

    @jsynowiec
    Author

    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: Don Jayamanne (@DonJayamanne)

  5. brettcannon commented on Mar 21, 2018

    @brettcannon
    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?

  6. jsynowiec commented on Mar 22, 2018

    @jsynowiec
    Author

    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.

  7. 3 remaining items

  8. NateScarlet commented on Mar 27, 2018

    @NateScarlet

    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.

  9. grechut commented on Mar 27, 2018

    @grechut

    Same here, py2.7.11 (pyenv)

  10. brettcannon commented on Mar 27, 2018

    @brettcannon
    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?

  11. jsynowiec commented on Mar 27, 2018

    @jsynowiec
    Author

    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.

  12. brettcannon commented on Mar 27, 2018

    @brettcannon
    Member

    Dave Halter (@davidhalter) is this a known regression in Jedi?

  13. davidhalter commented on Apr 4, 2018

    @davidhalter

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

  14. davidhalter commented on Apr 10, 2018

    @davidhalter

    Fixed on Jedi master.

  15. MikhailArkhipov commented on Apr 17, 2018

    @MikhailArkhipov
  16. 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

Assignees

No one assigned

    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