Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

'Go To Definition' takes many minutes to resolve in a moderately-sized project #492

Description

I tried to switch from Jedi to Python Language Server. DonJayamanne, at microsoft/vscode-python#2790, hinted that Jedi would become unsupported, and suggested creating bugs about why Python Language Server is unusable.

I switched off Jedi, restarted VSCode, opened the project I was working on (which sloccount estimates at about 4000 lines of code), and pressed F12 on a pretty typical local import, which looked like this:

from .sibling_module import function_name

A busy indicator (without an indication of progress) started moving under the tab bar. 15 minutes later, it's still going.

I would like to be able to provide more information, such as debug output from the language server, so I can tell what kind of rabbit hole it's falling down. But I can't locate any more information at the moment.

I am using VS Code 1.30 on Ubuntu 18.04, running Python 3.6.5 in a virtualenv.

Activity

  1. rspeer commented on Dec 13, 2018

    @rspeer
    Author

    At this point "many minutes" is an understatement. I don't think the F12 keypress is ever going to resolve.

    I found the suggestion to set "Python > Analysis: Log Level" to Trace.

    Now I can see that the Language Server's last output is that it is trying to analyze a file that I have deleted since the time I opened the folder. This may be relevant.

  2. rspeer commented on Dec 13, 2018

    @rspeer
    Author

    I restarted VS Code, went to the same file and pressed F12 again. This time there's almost no tracing output in the Python output window, only this:

    Starting Microsoft Python language server.
    ##########Linting Output - flake8##########
    86,1,E,E302:expected 2 blank lines, found 1
    ##########Linting Output - flake8##########
    ##########Linting Output - flake8##########
    ##########Linting Output - flake8##########
    

    Despite that it's not complaining about a deleted file this time, the spinner is still going and the F12 keypress is not resolving.

  3. rspeer commented on Dec 13, 2018

    @rspeer
    Author

    Oh! That one finished in about 2 minutes. All the language server tracing output appeared all at once, at the end. It contains hundreds of lines like Waiting for analysis of file:///FILENAME to complete., one for each file of Python code that my project depends on, including in other repositories.

    It's good that the analysis includes definitions in other repositories, but it's unfortunate that the language server has to wait for every file to be analyzed before it can go to a definition in any file.

    The overall result is still that "Go To Definition" is very slow and has no indication of progress, and also it seems that deleting a file may prevent it from working until you restart VS Code.

  4. jakebailey commented on Dec 13, 2018

    @jakebailey
    Member

    Go to definition (and other similar functionality) is limited by the analysis completing in many cases. We are currently working on a number of things which should speed up analysis as well as allow for go to def/find symbol/etc to operate without the rest of the analysis completing.

    Most of the logging done by the language server shows up in AnalysisLog.txt, which you can find in the extension directory next to the language server dll/binary.

  5. yevhen-m commented on Dec 14, 2018

    @yevhen-m

    I have the same issue. When language server engine is selected, I can't get autocomplete or goto (basically anything) even for a moderately small project. Vscode just shows a "loading" spinner that never ends.
    How can I troubleshoot?

    Parsing complete. Waiting for analysis entries to enqueue.
    Enqueue complete. Waiting for analysis to complete.
    

    I have lots of these in vscode -> output -> python.

  6. JeffHanna commented on Dec 15, 2018

    @JeffHanna

    I am encountering the same problems. The Python Language Server in VS Code is unsuitable for production work in a large codebase. The analysis never finishes, the outline view never populates, and the peek/go-to definition commands do nothing as they have no information on which to act. My options are to use Jedi, which is a resource hog, but mostly works, or to switch to a Python related IDE such as Wing or PyCharm that doesn't have these issues.

  7. jakebailey commented on Jan 10, 2019

    @jakebailey
    Member

    Finding symbols (+outline) and goto def are slightly different in practice. The former is slated to be handled by #521 (once I clean it up), which moves symbol indexing in parallel with the other analysis. Goto def is tied to the analysis (since we need to gather references), but may be improved with the new analysis.

  8. MikhailArkhipov commented on Feb 6, 2019

    @MikhailArkhipov

    #567
    Looks like general analysis performance.

  9. MikhailArkhipov commented on Mar 6, 2019

    @MikhailArkhipov

    0.2.16 is now available on beta channel.

    "python.analysis.downloadChannel": "beta"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions