-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
The ouline explorer doesn't populate for some files with latest 4.x #13928
Comments
@jnsebgosselin can you please check if the error persists if you update the PyLS repo after this PR palantir/python-language-server#866 ? |
Thanks for the followup @steff456. The issue is still happening with latest python-language-server on the I don't know if this is related, but there is an error that is reported in the log files. 2020-10-05 18:35:19,363 UTC - ERROR - pyls_jsonrpc.endpoint - Failed to handle notification textDocument/didOpen: {'textDocument': {'uri': 'file:///D:/test_outline_explorer.py', 'languageId': 'Python', 'version': 1, 'text': '# -*- coding: utf-8 -*-\n\n\ndef test_outline_explorer():\n a = 3\n c = b\n return a\n'}}
Traceback (most recent call last):
File "C:\Anaconda3\envs\python37\lib\site-packages\pyls_jsonrpc\endpoint.py", line 142, in _handle_notification
handler_result = handler(params)
File "C:\Anaconda3\envs\python37\lib\site-packages\pyls_jsonrpc\dispatchers.py", line 23, in handler
return method(**(params or {}))
File "C:\Users\User\python-language-server\pyls\python_ls.py", line 298, in m_text_document__did_open
workspace.put_document(textDocument['uri'], textDocument['text'], version=textDocument.get('version'))
AttributeError: 'NoneType' object has no attribute 'put_document' This error doesn't occur if I go before PR #13109 was merged on the 4.x branch. |
What version of json-rpc do you have in the environment? |
Thanks a lot @jnsebgosselin for your help with tracking this bug!
I think this is related to an error while initializing the PyLS because (according to your traceback) the document is trying to be assigned to a non-existing workspace. Could you try with PR #13828? That's ready for review and it should solve those issues. |
Thanks @ccordoba12 for your help with this. I tried with PR #13828 and this doesn't solve the problem with the outline explorer not working for some files, but this solve the broken code analysis for those files and there isn't any traceback in the log files anymore... What is very strange is that this seems to be related to the location of the files. I have folder that if I put any file in it, then Spyder is unable to build the outline explorer tree. If I take these files out and put them in another location, then everything seems to be working fine... this is really strange. |
ok, I don't know exactly what I did, but after restarting Spyder multiple times and deleting, renaming, copying, moving some files around, changing the root directory, the working directy, closing and opening my Spyder project, etc.... the problem seems to be fixed when running Spyder with PR #13828. So maybe PR #13828 did fixed the problem after all and the problem was still occurring because of temp files or something? Anyway, I don't know. I suggest not to close this yet, I'll go through my day and I'll report back if the problem is indeed completely resolved or not. |
This is great news! Thanks for the confirmation @jnsebgosselin!
I was investigating this problem yesterday and I think I found the cause. I'm preparing a PR now and I'll ping you when it's up. |
@ccordoba12 after working in Spyder all day using PR #13828, I cannot reproduce this bug anymore. So I guess PR #13828 did indeed fix this issue. The reason why I was still experiencing this issue after switching to PR #13828 and restarting Spyder might be because of some caching mechanism that eventually got resolved after I restarted Spyder several times and deleted/renamed/moved/restored the problematic folders? In all cases, I cannot reproduce this problem anymore, so I think this issue should be closed now, or after PR #13828 is merged. It is as you wish. |
Here I was talking about files for which the outline explorer did not work at all, even after triggering a document change manually and even if the file was focused on startup. Maybe I was not clear in my opening post, but it was not related to the issue where the outline tree was not populated automatically for the files that were opened in the previous session. This particular issue, I reported in #13897. |
Just to clarify my last post. I was experiencing two clearly distinct bugs with the outline explorer. The first one was that the outline explorer was not populating the outline tree automatically for the files that were opened in the previous session. That I reported in Issue #13897, which I think is going to be fixed by PR #13938. The second bug, which I reported here, was that no matter what I did, for some files, I was not able to get the outline explorer to work. This specific issue I cannot reproduce anymore after working all day with PR #13828. |
OK, I can still reproduce the issue even when using PR #13828, but I have new information that could help to pinpoint the issue. The issue seems to happen only when a Spyder project is active. When it is the case, then the outline explorer just cannot populate the tree for some files. The wheel is spinning endlessly. If I close the project, then the outline explorer is able to populate the tree for these same files without any problem. |
Sorry, I thought this issue was about that problem. And yes, it's going to be fixed by PR #13938.
This should be solved by the combined effect of PRs #13828 and #13938. So do you want to keep this one open until those PRs are merged? |
And that's even with both my PRs applied? |
Yes. The only difference is that the wheel stop spinning after a second or two, but the tree is never populated. |
Ok, I'll take a look at that once my PRs are merged. |
@ccordoba12 for the Spyder reproducible case, if I had a |
I am able to produce a very simple example for reproducing the issue. Basically, all you need to do is:
The outline tree for the file that is in the subfolder is not going to be populated unless you add a |
This looks like an issue with Jedi or the PyLS, so not an easy fix. But thanks for the reproducible example. |
Ok , this is not good news :/ Let me know if I can help further with this issue. I've tried to look more into it, but unfortunately, all that pyls stuff is a little bit over my head... |
Problem Description
The outline explorer just doesn't want to populate at all for some files on my system. Moreover, the code style and error analysis do not seem to work for these files too.
Here are some lsp logs that I have created by trying to open a very simple file for which the outline explorer doesn't work.
transport_python_1716.log
server_python_1716.log
The content of the file was simply:
Versions
Dependencies
The text was updated successfully, but these errors were encountered: