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

Outline view only filled after typing #1823

Closed
mrx23dot opened this issue Sep 16, 2021 · 8 comments
Closed

Outline view only filled after typing #1823

mrx23dot opened this issue Sep 16, 2021 · 8 comments
Assignees
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@mrx23dot
Copy link

Issue Type: Bug

Outline view works before installing Pylance.
I install Pylance
python.languageServer is set from Jedi to Pylance
Then Outline view is only populated when I start typing.

My guess is that the parsing engine is not started till I start typing.

Extension version: 2021.9.1
VS Code version: Code 1.60.1 (83bd43bc519d15e50c4272c6cf5c1479df196a4d, 2021-09-10T17:07:10.714Z)
OS version: Windows_NT x64 10.0.18363
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 x 2304)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.81GB (4.09GB free)
Process Argv --crash-reporter-id e4b48720-5a3d-4415-bc92-03f829fdb834
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspyt653:30270858
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30358480
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlangct:30333562
binariesv615:30325510
vsccppwt:30364497
pythonvssor306:30344512
bridge0708:30335490
pygetstartedc2:30360494
bridge0723:30353136
pythonrunftest32:30365366
pythonf5test824:30361777
javagetstartedt:30364666
pythonvspyt187:30365361
pydsgst2:30361792
vscus224cf:30367820
vssid140cf:30363604
vssur157:30367808

@erictraut
Copy link
Contributor

This is related to #1424.

I suspect it's due to an interaction between the Python extension and Pylance. If the initial outline request arrives before the Python extension is fully initialized, the request is not forwarded to Pylance. That's just a theory based on the symptoms.

@jakebailey
Copy link
Member

How annoying; I really thought this race had long since been fixed.

Overall, this whole thing is confusing. What makes the outline different than something like semantic tokens, which is also sent when a file is opened or the LS starts?

@mrx23dot If you can reproduce this easily, would you mind gathering an LSP trace doing the steps you described?

You can enable LSP tracing by setting the (undocumented) setting "python.trace.server": "verbose", reloading, then copy the output from the Python Language Server output window.

@jakebailey jakebailey added the waiting for user response Requires more information from user label Sep 16, 2021
@github-actions github-actions bot removed the triage label Sep 16, 2021
@mrx23dot
Copy link
Author

mrx23dot commented Sep 17, 2021

Sure, before line 4660 is the startup, then I start typing.

lang_serv_log.txt

It's reproducible with a clean install, without any settings. Everything should be latest version.

@erictraut
Copy link
Contributor

The outline information comes from the LSP request 'textDocument/documentSymbol'. You can see this was requested at line 6872 and was returned at line 6880 in the log. It is not requested prior to that. This request should have been received just after the document was opened (line 722).

@jakebailey
Copy link
Member

Thanks for the logs; I can definitely see that there's no documentSymbol before the first didChange. This to me smells like a client bug; surely VS Code should be sending the request after it opens the document. We don't even get one. (And we are also very happy to handle documentSymbol on unopened documents too; it's just that VS Code didn't even send the request...)

@jakebailey jakebailey added needs investigation Could be an issue - needs investigation and removed waiting for user response Requires more information from user labels Sep 17, 2021
@erictraut
Copy link
Contributor

When I investigated this earlier, I was never able to get this to repro with pyright, but I was able to repro it with pylance + the Python extension. So I suspect it's a race condition somewhere. My guess is that it's in the Python extension, but it's possible that it's in VS Code itself, and the longer startup time of the Python extension triggers the race condition.

@mrx23dot
Copy link
Author

If we are sure that pylance displays every signal from VS without filtering that would mean VS didn't emit the signal.

@heejaechang
Copy link
Contributor

@mrx23dot I can't repro this with the latest pylance. please reopen if it still repro.

@heejaechang heejaechang added fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants