Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Language server only displays the top level symbols #2050

Closed
peterlevi opened this issue Jun 22, 2018 · 14 comments
Closed

New Language server only displays the top level symbols #2050

peterlevi opened this issue Jun 22, 2018 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@peterlevi
Copy link

peterlevi commented Jun 22, 2018

Environment data

  • VS Code version: 1.24.1
  • Extension version (available under the Extensions sidebar): 2018.6.0
  • OS and version: Ubuntu 16.04 x64
  • Python version (& distribution if applicable, e.g. Anaconda): Python 2.7.12
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A

Actual behavior

Language server

Only top-level items are listed.

Jedi

"Go to Symbol in File..." is most times very very slow on 1.24.1
on a largish Python file (~1500 lines) - most times I'm just looking at the animated thingie. In some cases (if I give it enough time to finish?) the second time I invoke it, it appears and lists symbols fast, but next time it's slow again. Using it on this file: https://github.com/peterlevi/ojo/blob/master/ojo/ojo.py (vscode started directly in the root of that whole repo). In cases when it appears, it lists 646 symbols in the file.

vscode_slow_goto_symbol

Issue first reported as a comment here: microsoft/vscode-cpptools#1472 (comment)

Expected behavior

"Go to Symbol in File..." to be usable

Steps to reproduce:

  1. git clone https://github.com/peterlevi/ojo.git
  2. cd ojo
  3. code .
  4. Open ojo.py
  5. Press shortcut for invoking "Go To Symbol in File..."

Logs

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

Starting the classic analysis engine.
##########Linting Output - pylint##########
No config file found, using default configuration
/home/peter/.local/lib/python2.7/site-packages/astroid/brain/brain_gi.py:136: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
  __import__(m)
************* Module ojo.ojo
1269,0,warning,W1401:Anomalous backslash in string: '\W'. String constant might be missing an r prefix.
349,8,warning,W0602:Using global for 'killed' but no assignment is done
1275,18,error,E1121:Too many positional arguments for method call
1282,34,warning,W0612:Unused variable 'e'
1345,19,error,E0712:Catching an exception which doesn't inherit from BaseException: GError
1337,12,warning,W0612:Unused variable 'format'
1345,35,warning,W0612:Unused variable 'e'
1243,34,error,E0203:Access to member 'wheel_timer' before its definition line 1247

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

 INFO no standard startup: not the explorer viewlet
TMSyntax.ts:44 Overwriting grammar scope name to file mapping for scope source.python.
Old grammar file: /usr/share/code/resources/app/extensions/python/syntaxes/MagicPython.tmLanguage.json.
New grammar file: /home/peter/.vscode/extensions/magicstack.magicpython-1.0.12/grammars/MagicPython.tmLanguage
e.register @ TMSyntax.ts:44
@DonJayamanne
Copy link

Please could you try the following:

  • Open your settings file settings.json
  • Add the following setting "python.jediEnabled": false
  • You'll be prompted to restart VS Code, please do so and wait for the new language server to get downloaded and initialized.
  • After a minute or two, intellisense should start working
  • Please test Go to Symbol once again

Note: Since this is the first time you'll be using this new lanaguge server, you'll need to be patient for it to get downloaded and started (slow only the first time).
Also please note, this is still in the early phases of development, hence there may be a few issues, if you do come across any please do report them.

Finally, you can alway revert to using the old language server by change the setting to "python.jediEnabled": true

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster feature-code navigation labels Jun 22, 2018
@peterlevi
Copy link
Author

I tried the above steps. It is fast now, but behaves incorrectly because it lists only the 4 top-level symbols in the file, and ignores all of the symbols within the single and, admittedly, humongous god-like class in the file. Here's a screenshot:
vscode_new_python_langserver

@no-response no-response bot removed the info-needed Issue requires more information from poster label Jun 23, 2018
@derekwallace
Copy link

I see the same behaviour. using latest nighly and the new Python analysis engine (jedi disabled)
Intellisense works correctly and lists symbols as i type

image

Go to symbol only lists the toplevel class

image

@DonJayamanne
Copy link

DonJayamanne commented Jun 27, 2018

Ok, I'll change the title to reflect the new issue in the language server.

@DonJayamanne DonJayamanne changed the title "Go to Symbol in File..." is unusably slow New Language server only displays the top level symbols Jun 27, 2018
@derekwallace
Copy link

This may be useful when debugging.
Outline currently wrong (only toplevel class)
image

If i start to type a new method , it updates with all the methods.
image

Now when i complete the prototype, they disappear.
image

@derekwallace
Copy link

@DonJayamanne Any idea when this issue will be resolved? In general the new analysis engine solves all the issues with intellisense vs using jedi analysis engine.

@brettcannon
Copy link
Member

@derekwallace we don't give out ETAs as a general rule, plus the language server is still experimental so we really don't give out ETAs regarding it

@brettcannon
Copy link
Member

I can verify that the next version of the language server that will be available with the 2018.7.0 release of the extension will list more than 4 items, but it does not yet support methods within a class.

capture

@DonJayamanne
Copy link

DonJayamanne commented Jul 18, 2018

but it does not yet support methods within a class.

That's interesting, this is a bug if it doesn't. It used to work.
The extension relies on this to work as we need to get a list of methods in a test suite when displaying code lenses.

@MikhailArkhipov
Copy link

The symbols and variables in classes and functions are known, we just happen not to transfer them out to VSC.

@DonJayamanne
Copy link

DonJayamanne commented Aug 7, 2018

@MikailArkhipov, method names are not returned either.
This impacts the ability to display codelenses above unit test methods.

I am almost 99.99% certain this used to work at a certain point.

@MikhailArkhipov
Copy link

No, it never drilled into nested scopes. It does now
image

@MikhailArkhipov
Copy link

microsoft/PTVS#4624

@MikhailArkhipov
Copy link

#2334 still applies though.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants