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
Spyder always sends transformed document text EOL to LF in LSP requests. Therefore, when the server calculates an object position, it's considering LF as EOL. However, this results in a position mismatch if the document EOL is CRLF or CR as Spyder expects the position accordingly.
This could be server-sided solved, as the server could identify the document EOL and use that to convert the position accordingly, but I don't know if this approach breaks the (Language Server Protocol)[https://microsoft.github.io/language-server-protocol/]. Besides, the Server Implementation that was tested does not result in this bug with VSCode, so it probably should be solved client-sided.
What steps reproduce the problem?
Open a document with CRLF as EOL
Use the go-to reference (can be any LSP request that's position sensitive)
Results in the wrong position.
What is the expected output? What do you see instead?
It is expected the correct object's reference in the editor, but it leads to a wrong position instead.
Paste Traceback/Error Below (if applicable)
No traceback is applicable.
Versions
Spyder version: 5.0.4
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
It seems that spyder.plugins.editor.widgets.codeeditor methods document_did_open, document_did_change and document_did_save uses toPlainText method to send the document text to the language server:
Hey @hlouzada, thanks a lot for reporting and investigating this problem. Please submit a pull request with the fix you consider necessary for it. That way it would be easier for us to understand what you have in mind and give you feedback about it.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
Spyder always sends transformed document text EOL to LF in LSP requests. Therefore, when the server calculates an object position, it's considering LF as EOL. However, this results in a position mismatch if the document EOL is CRLF or CR as Spyder expects the position accordingly.
This could be server-sided solved, as the server could identify the document EOL and use that to convert the position accordingly, but I don't know if this approach breaks the (Language Server Protocol)[https://microsoft.github.io/language-server-protocol/]. Besides, the Server Implementation that was tested does not result in this bug with VSCode, so it probably should be solved client-sided.
What steps reproduce the problem?
What is the expected output? What do you see instead?
It is expected the correct object's reference in the editor, but it leads to a wrong position instead.
Paste Traceback/Error Below (if applicable)
No traceback is applicable.
Versions
Dependencies
The text was updated successfully, but these errors were encountered: