Steps to Reproduce:
I have checked all extensions I'm using, and this occurs only when Python and GitLens are enabled together. The problem does not occur when disabling GitLens.
I'm pretty sure this is yet another case of https://github.com/DonJayamanne/pythonVSCode/issues/553 which was never fixed as far as I know.
Opened this on the MS repo: https://github.com/Microsoft/vscode-python/issues/2112
@rjbruin I believe Microsoft released a completely new version of the Python language server (as part of the Python extension) yesterday or today. Can you try it and see if this is still an issue?
Unfortunately the problem still persists with vscode-python 2018.7.0 and GitLens 8.5.2.
Damn :(
@rjbruin, make sure you have "python.jediEnabled": false in your settings. That will activate the new language server.
@ericsnowcurrently Thanks!
It seems the issue is connected to the new language server:
"python.jediEnabled": true: works;"python.jediEnabled": false: no file outline will load anymore, and switching out of Explorer and back doesn't return the outline anymoreHowever, even when disabling the new language server and enabling GitLens the issue remains. Even more confusing, I'm not seeing the same behavior anymore even with the settings of the original issue:
"python.jediEnabled": true (original issue): certain files load without problem, while others don't. Things I've tried to narrow down the differences:I'm getting kind of lost here. As for the GitLens issue, it seems to have to do with the repository the file is in. If I can do anything to help debug this, please let me know!
@rjbruin, if it's okay, let's discuss this on Microsoft/vscode-python#2112. If you want to keep the discussion here I can work with that. :)
@ericsnowcurrently I'm fine with that, though I assume you only want to talk about the language server there and leave the GitLens issue here?
Correct. I just don't want to clutter up this issue with stuff that doesn't relate to GitLens. :)
All related issues are marked as closed, but problem is still there with GitLens 9.7.3, Python 2019.4.12954 and VS code Version: 1.34.20-insider
All related issues are marked as closed, but problem is still there with GitLens 9.7.3, Python 2019.4.12954 and VS code Version: 1.34.20-insider
Yeah, I'm being forced to use Jedi because of another bug in Python Language Server, and so have had to turn off GitLens. :-(
Yeah, I'm being forced to use Jedi because of another bug in Python Language Server, and so have had to turn off GitLens. :-(
@eamodio When using the Python Language Server, there's no extension code involved. Its purely Language Server (protocol that communicates with VS Code). So I don't see how this would be an extension issue.
I.e. it seem this issue occurs whether users use language server or not (in Python Extension - i.e. it isn't any typescript code in Python Extension).
I'd say this is an issue upstream on VS Code.
@DonJayamanne Last I looked into this (which was a LONG time ago), the core issue was that multiple places (GitLens, outline view, etc) call into the language server (via executeDocumentSymbolProvider) which only returned valid symbols for one request. So sometimes that would be GitLens, and the outline view would break, or sometimes it was the outline view, then GitLens code lens wouldn't show. And it seemed to only really manifest itself if the calls were in close succession -- like it was actually processing one request while the other one came in.
@eamodio yeah, can confirm this. Guess this should be fixed in the language server API?! Is there an issue related to this?
which only returned valid symbols for one request. So sometimes that would be GitLens, and the outline view would break, or sometimes it was the outline view, then GitLens code lens wouldn't show. And it seemed to only really manifest itself if the calls were in close succession -- like it was actually processing one request while the other one came in.
Wouldn't this be an issue with VS Code. After all, you're invoking VS Code API.
AFAIK, the vscode api just calls into the extension/language servers (those registered with registerDocumentSymbolProvider) so if no data is returned by them, there is nothing vscode can do.
@DonJayamanne could this be the cause:
It looks like if 2 requests come in quickly the first one will be resolved with an empty array.
Not sure why both requests wouldn't just resolve to the same promise.
It looks like if 2 requests come in quickly the first one will be resolved with an empty array.
Not sure why both requests wouldn't just resolve to the same promise.
I wonder if the subsequent request is expecting that the file has been modified since the first request. IIRC CodeLens requests seem to trigger when files are both modified and saved.
It looks like if 2 requests come in quickly the first one will be resolved with an empty array.
Agreed, will fix that. Still not sure how that should cause any issues. Anyways.
@DonJayamanne
The issue it causes, is that if GitLens and say the Outline view make a call to get the document symbols in quick succession one of them will get results and the other will get an empty array.
I changed Language server to jedi, now I have an outline
Most helpful comment
All related issues are marked as closed, but problem is still there with GitLens 9.7.3, Python 2019.4.12954 and VS code Version: 1.34.20-insider