-
Notifications
You must be signed in to change notification settings - Fork 213
textDocument/documentSymbol
returns empty result for non-existing files
#301
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
Comments
Hey @rear1019, thanks for reporting. What do you propose to fix the issue? Removing the try/except you referenced? |
I am not quite sure, but I think that I can make a PR if the proposed fix is deemed correct. ¹ Or a variant thereof, depending on the required Python/Jedi compatibility. |
Right, then I agree with your proposed solution. Please submit a PR for it. |
Add a test for `textDocument/documentSymbols` of a non-existing (unsaved) file. The test fails as of this commit and is a regression test for issue python-lsp#301 [1]. [1] python-lsp#301
Fix `textDocument/documentSymbols` returning an empty result for non-existing (unsaved) files: Do not use `os.path.samefile()` which accesses the file system to check if two file paths point to the same file. Just compare the file paths. (This basically reverts commit 40afab3.) This fixes issue python-lsp#301 [1]. [1] python-lsp#301
Fix `textDocument/documentSymbols` returning an empty result for non-existing (unsaved) files: Do not use `os.path.samefile()` which accesses the file system to check if two file paths point to the same file. Just compare the file paths. (This basically reverts commit 40afab3.) This fixes issue python-lsp#301 [1]. [1] python-lsp#301
textDocument/documentSymbol
returns an empty result for non-existing files even though Jedi does provide symbol information. The culprit us the following code:python-lsp-server/pylsp/plugins/symbols.py
Lines 94 to 99 in 0c76a52
This can reproduced by creating a new file in Spyder: No symbol information is available in the Symbols Switcher and Outline plugin as long as the file is not saved¹. Code folding and linting does work.
¹ Note: Saving the new file is not sufficient to fix the issue in Spyder <= 5.4.0 due an another unrelated bug. See spyder/spyder-ide#20047.
EDIT: Formatting
The text was updated successfully, but these errors were encountered: