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
If I rename a function or variable in a document which contains a SytnaxError (or IndentationError, or anything else which causes the document not to be a valid Python source code), the rename fails with IndexError: list index out of range. The failing rename is not a problem in itself, but the unclear error may cause distress in users trying to understand what is going on.
Full backtrace is attached here. From what I understand, this is because rope cannot load the file (as it is not a valid Python source) thus lines list remain empty (so the requested position is out of range).
Expected behaviour: an informative error is passed to the client, e.g.
"Rename could not be performed due to a SyntaxError at line X"
Question: should it be solved in pyls or in rope?
Proposed solution: the code in rope_rename.py could by wrapped in try-except to catch rope errors, or (if you advise such) I could fill an issue in rope repository.
The text was updated successfully, but these errors were encountered:
krassowski
changed the title
Rename of varaibles (with rope) fails bluntly if there is a SyntaxError
Rename of variables (with rope) fails bluntly if there is a SyntaxError
Jan 4, 2020
If I rename a function or variable in a document which contains a SytnaxError (or IndentationError, or anything else which causes the document not to be a valid Python source code), the rename fails with
IndexError: list index out of range
. The failing rename is not a problem in itself, but the unclear error may cause distress in users trying to understand what is going on.Full backtrace is attached here. From what I understand, this is because rope cannot load the file (as it is not a valid Python source) thus
lines
list remain empty (so the requested position is out of range).Expected behaviour: an informative error is passed to the client, e.g.
Question: should it be solved in pyls or in rope?
Proposed solution: the code in
rope_rename.py
could by wrapped in try-except to catch rope errors, or (if you advise such) I could fill an issue in rope repository.References: https://github.com/krassowski/jupyterlab-lsp/pull/115, https://github.com/krassowski/jupyterlab-lsp/pull/127 (while we already got a UX workaround, I thought that reporting it here may help others who implement LSP/use the pyls server).
The text was updated successfully, but these errors were encountered: