vscode-python: Go to definition not working anymore

Environment data

  • VS Code version: 1.33.1 (Stable Channel)
  • Extension version (ms-python.python): 2019.3.6558
  • OS and version: Ubuntu 18.04
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7.15
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
  • Relevant/affected Python packages and their versions: None

Expected behaviour

Visual Studio Code navigate to the definition of the function which resides inside the workspace (Working fine earlier)

Actual behaviour

Popup with Message: "No definition found for ‘function_name’ "

Steps to reproduce:

  1. import the class from another python file
  2. declare and initialize the class
  3. implement any method of the class
  4. after that right click on method and choose go to definition

For example: from commonlib.helpers.general_helper import Helper helper = Helper() user_data = helper.get_user_profile(user_id)

Logs

No logs or errors in console

Things to note

But if you hover the implementation then it will show you the class with function name and all the parameters of the functions that are requested in definition of the function. It’s also suggesting the function while implementing. So maybe there is some issue with only “Go to Definition”.

Also one more thing if you’ve written function in same class and use self.method_name() then it will able to navigate to the method

Things I’ve tried

  • Tried to reinstall the python extension (ms-python.python) >> Not worked
  • Tried to install earlier versions of the python extension (ms-python.python) >> Not worked
  • Closing all the files and reopening of the workspace >> Not worked
  • Opening the definition file in new tab and tried “Go to definition” >> Not worked
  • Tried to downgrade VS Code to earlier versions 1.32 and 1.31 >> Not worked
  • Tried to disable all other extensions except python (ms-python.python) >> Not worked

Please if possible provide an urgent upstream-fix or any temporary fix to resolve this issue.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 16

Most upvoted comments

I can also reproduce this using a base case as outlined in the attached screenshot. “Go to Definition” on the get_name() method no longer works.

image

VS Code:1.33.1 Python Extension:2019.4.11987 Visual Studio IntelliCode - Preview: 1.1.5 OS: mac OS 10.14.2 virtual environment: conda