vscode-python: Symbol navigation via ctrl-t does not work when the microsoft language server is enabled (jedi disabled)

Environment data

  • VS Code version: 1.27.2
  • Extension version (available under the Extensions sidebar): 2018.8.0
  • OS and version: Ubuntu 16.04
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6 or 3.7 built from source
  • Type of virtual environment used: virtualenv / python -m venv
  • Relevant/affected Python packages and their versions: N/A

Steps to reproduce:

Disable jedi in settings.json. Here the full settings.json I used to make sure that this issue is not caused by a problem in my config:

{
    "python.jediEnabled": false
}

Then try with the following mixed Python/Cython/C/C++ code base:

$ git clone https://github.com/scikit-learn/scikit-learn
$ cd scikit-learn
$ code .

Then hit “ctrl-t” and type “KMeans” for instance.

Actual behavior

The ctrl-t menu is never populated as expected (it stays empty). I have the same problem with other symbols defined in this project (e.g. LogisticRegression, check_array…).

The “Analysing workspace, 1 item remaining…” message never goes away.

Weirdly enough, hitting “F12” on a Python symbol defined in the workspace can make VS code navigate to it successfully. It’s just the ctrl-t symbol search menu that’s broken.

Expected behavior

Being able to open the k_means_.py file from the project folder in the workspace to navigate to the definition of the KMeans class.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting Microsoft Python language server.
Initializing for /volatile/ogrisel/.virtualenvs/py36/bin/python
##########Linting Output - pylint##########
[snip]

[Error - 09:52:35] Request workspace/symbol failed.
  Message: Object reference not set to an instance of an object.
  Code: -32000 
[object Object]
[Error - 09:52:36] Request workspace/symbol failed.
  Message: Object reference not set to an instance of an object.
  Code: -32000 
[object Object]
...

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

[nothing]

Also note that jedi has no problem with this workspace.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

I confirm that the Go To Symbol feature works on scikit-learn when using the beta channel. Thank you very much.

Looking forward to the resolution for the CPU usage issue now 😃 The trace output shows that the language server never seems to get back analysis results for the majority of the files of the project: only the first queued file (in my cases setup.py) ever receives an analysis back from the language server. All the other queued files seem to be stalled and CPU usage stays at 100% forever without any output in the trace-level log.

Feel free to close this issue if you wish, as the symbol navigation part is fixed.

It’s currently in our daily and beta channels, not the stable release (since it’s brand new). You can switch to one of those to test a non-stable build by setting one of the following in your settings:

"python.analysis.downloadChannel": "daily"
"python.analysis.downloadChannel": "beta"

If you want to go back to stable, you can remove that line and delete the folders with names starting with languageServer inside of the extension’s directory, as the extension will not rollback to an older version.

We fixed the bugs causing the errors, however we have not yet removed the big “wait until analysis is complete” blockers in those “find-something” calls (see https://github.com/Microsoft/python-language-server/issues/378#issuecomment-437597629). Not being able to make those calls is for now still the implemented behavior.

You may be interested in watching Microsoft/python-language-server#433, which aims to solve the problem a different way. I may still try removing those blocks to see what happens, though.