Skip to content

Go To Definition of decorated functions that get wrapped goes to the wrapping function #1638

@PeterJCLaw

Description

@PeterJCLaw

This appears to be regression of https://github.com/DonJayamanne/pythonVSCode/issues/742

Environment data

  • VS Code version: 1.22.2 and 1.23.0
  • Extension version: 2018.4.0 (edit: confirmed not an issue under 2018.3.1)
  • OS and version: Ubuntu 16.04.4 LTS (Xenial)
  • Python version: 2.7 and 3.5 tested
  • Type of virtual environment used: None (for Python 2.7), virtualenvwrapper (for Python 3.5)
  • Relevant/affected Python packages and their versions: —

Actual behavior

Navigating to definition of a decorated function shows the definition of the decorator.

Note: this only reproduces in a package and not in a single file.

In one sense I can see why this is happening -- the decorator is actually what the symbol in question really is. However, that is not a useful thing for an editor to do and I would much prefer to be shown the definition of the decorated function instead.

I believe this is also a regression as I've only noticed this behaviour recently (I think it started failing some time after the new year, but I'm not sure).

Expected behavior

(copied from https://github.com/DonJayamanne/pythonVSCode/issues/742)
Navigating to definition of a decorated function should show the function in question.

Steps to reproduce:

(copied from https://github.com/DonJayamanne/pythonVSCode/issues/742)

This issue shows up for both class- and function-based decorators and for both local and standard-library decorators.

Logs

None from either the Output pane or the developer tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    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