You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried the other applicable steps from the Troubleshooting Guide
Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
The LSP specifies that textDocumentSymbol request can respond with DocumentSymbol or SymbolInformation. Currently, spyder only supports SymbolInformation so I would like to suggest adding support to DocumentSymbol since it specifies children's objects, therefore reducing the Spyder's computational weight to search for possible parents.
A workaround can be made by patching spyder.editor.widgets.codeeditor.CodeEditor.process_symbols:
@handles(CompletionRequestTypes.DOCUMENT_SYMBOL)defprocess_symbols(self, params):
"""Handle symbols response."""try:
symbols=params['params']
symbols= [] ifsymbolsisNoneelsesymbolsifsymbolsand"location"notinsymbols[0]:
forsymbolinsymbols:
symbol["location"] = {"range": symbol["range"]}
self.classfuncdropdown.update_data(symbols)
ifself.oe_proxyisnotNone:
self.oe_proxy.update_outline_info(symbols)
exceptRuntimeError:
# This is triggered when a codeeditor instance was removed# before the response can be processed.returnexceptException:
self.log_lsp_handle_errors("Error when processing symbols")
What steps reproduce the problem?
Configure any LSP Server that uses DocumentSymbol instead of SymbolInformation
Open Document
Open Outline panel
What is the expected output? What do you see instead?
It's expected a populated Tree in Outline Panel, but nothing is displayed.
Paste Traceback/Error Below (if applicable)
2021-06-01 13:27:42,322 [ERROR] [spyder.plugins.editor.widgets.codeeditor] -> Error when processing symbols
Traceback (most recent call last):
File "c:\users\hendr\anaconda3\envs\ciermag-develop\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1121, in process_symbolsself.classfuncdropdown.update_data(symbols)
File "c:\users\hendr\anaconda3\envs\ciermag-develop\lib\site-packages\spyder\plugins\editor\panels\classfunctiondropdown.py", line 207, in update_data
line_start = item['location']['range']['start']['line']
KeyError: 'location'
Versions
Spyder version: 5.0.3
Python version: 3.8.5
Qt version: 5.12.10
PyQt version: 5.12.3
Operating System name/version: Windows-10-10.0.21390-SP0
We definitely need to add this to Spyder 's client for it to work. If you are interested in helping us with this enhancement, we could give you all the guidance you need.
I would be delighted to help, but currently, I don't have enough time available and, as it's not critical for my Language Server project, it'll have to wait until I have more time. Although, there is another issue that I recently found (#15900) that I could help with if it's necessary as it's a critical bug.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
The LSP specifies that textDocumentSymbol request can respond with
DocumentSymbol
orSymbolInformation
. Currently, spyder only supportsSymbolInformation
so I would like to suggest adding support toDocumentSymbol
since it specifies children's objects, therefore reducing the Spyder's computational weight to search for possible parents.Refer to Language Server Protocol for more details.
A workaround can be made by patching
spyder.editor.widgets.codeeditor.CodeEditor.process_symbols
:What steps reproduce the problem?
DocumentSymbol
instead ofSymbolInformation
What is the expected output? What do you see instead?
It's expected a populated Tree in Outline Panel, but nothing is displayed.
Paste Traceback/Error Below (if applicable)
Versions
Dependencies
The text was updated successfully, but these errors were encountered: