Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

RLS responds code deletions when formatting with Unexpected Operator Error #1710

Open
domibay-hugo opened this issue Jan 13, 2021 · 1 comment

Comments

@domibay-hugo
Copy link

Using the Eclipse Corrosion Plugin with rls I found that I get wrong error reports when formatting the code.
How to reproduce?

  • Mark spaces at the beginning of the line and delete them.
  • Move ahead one line at the time

The Log File org.eclipse.corrosion.rls.log reports:

[t=1610534599878] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 28636


[t=1610534599878] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///path/to/my_project/src/my-project-1.rs"},"text":"\[...\]"}}
[t=1610535058631] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 291


[t=1610535058631] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":27,"uri":"file:///path/to/my_project/src/my-project-1.rs"},"contentChanges":[{"range":{"start":{"line":415,"character":0},"end":{"line":415,"character":6}},"rangeLength":6,"text":""}]}}
[t=1610535060371] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 291


[t=1610535060371] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":28,"uri":"file:///path/to/my_project/src/my-project-1.rs"},"contentChanges":[{"range":{"start":{"line":416,"character":0},"end":{"line":416,"character":6}},"rangeLength":6,"text":""}]}}
[t=1610535060769] org.eclipse.corrosion.rls to LSP4E:
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"","message":"expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `vlocs`\n\nexpected one of 8 possible tokens","range":{"end":{"character":7,"line":416},"start":{"character":2,"line":416}},"severity":1,"source":"rustc"}],"uri":"file:///path/to/my_project/src/my-project-1.rs"}}
[t=1610535061666] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 291


[t=1610535061666] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":29,"uri":"file:///path/to/my_project/src/my-project-1.rs"},"contentChanges":[{"range":{"start":{"line":417,"character":0},"end":{"line":417,"character":6}},"rangeLength":6,"text":""}]}}

[t=1610535065149] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 291


[t=1610535065150] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":30,"uri":"file:///path/to/my_project/src/my-project-1.rs"},"contentChanges":[{"range":{"start":{"line":418,"character":0},"end":{"line":418,"character":6}},"rangeLength":6,"text":""}]}}
[t=1610535065336] org.eclipse.corrosion.rls to LSP4E:
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"","message":"expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `vlocs`\n\nexpected one of 8 possible tokens","range":{"end":{"character":7,"line":416},"start":{"character":2,"line":416}},"severity":1,"source":"rustc"}],"uri":"file:///path/to/my_project/src/my-project-1.rs"}}

Although the source code file was resubmitted recently the submitted deletions lead to a corrupted Index of the File in rls accusing of an error where there isn't any.

@domibay-hugo domibay-hugo changed the title RLS reponds code deletions when formatting with Unexpected Operator Error RLS responds code deletions when formatting with Unexpected Operator Error Jan 13, 2021
@domibay-hugo
Copy link
Author

domibay-hugo commented Jan 13, 2021

On the affected line I deleted the Semicolon ; and reinserted it and saved the document but the accused error never is notified as corrected.

[t=1610537117415] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 293


[t=1610537117415] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":55,"uri":"file:///path/to/my_project/src/my-project-1.rs"},"contentChanges":[{"range":{"start":{"line":416,"character":51},"end":{"line":416,"character":52}},"rangeLength":1,"text":""}]}}
[t=1610537129256] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 293


[t=1610537129257] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"version":2,"uri":"file:///path/to/my_project/src/my-project-1.rs"},"contentChanges":[{"range":{"start":{"line":416,"character":51},"end":{"line":416,"character":51}},"rangeLength":0,"text":";"}]}}
[t=1610537134176] LSP4E to org.eclipse.corrosion.rls:
Content-Length: 28616


[t=1610537134176] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///path/to/my_project/src/my-project-1.rs"},"text":"\[..\]"}}

What should be the correct Procedure and LSP Communication to get the Correction Notification ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant