Skip to content
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

Blank editor after formatting source code via LS #902

Closed
ghentschke opened this issue Jan 27, 2024 · 0 comments · Fixed by #903
Closed

Blank editor after formatting source code via LS #902

ghentschke opened this issue Jan 27, 2024 · 0 comments · Fixed by #903

Comments

@ghentschke
Copy link
Contributor

ghentschke commented Jan 27, 2024

When formatting a source code file in the editor, the editor can become blank caused by a BadLocationException during TextViewer.setRedraw. See this cdt-lsp issue for further details

After some investigation I found out that it will be triggered, when the TextEdit response on a textDocument/formatting request leads to a splitting of the \r\n line ending. See this comment.

This could be fixed in org.eclipse.lsp4e.LSPEclipseUtils.applyEdits(IDocument, List<? extends TextEdit>). I can provide a PR for that.

ghentschke added a commit to ghentschke/lsp4e-bachmann-fixes that referenced this issue Jan 27, 2024
Splitting \r\n line endings leads to a BadLocationException while
TextViewer.setRedraw is executed during a document.replace operation
triggered by a TextEdit.

fixes eclipse#902
ghentschke added a commit to ghentschke/lsp4e-bachmann-fixes that referenced this issue Jan 28, 2024
Adds unit test to validate change.

fixes eclipse#902
ghentschke added a commit to ghentschke/lsp4e-bachmann-fixes that referenced this issue Jan 28, 2024
Add check in case that end line from edit is larger than the documents
number of lines.

fixes eclipse#902
mickaelistria pushed a commit that referenced this issue Jan 29, 2024
Splitting \r\n line endings leads to a BadLocationException while
TextViewer.setRedraw is executed during a document.replace operation
triggered by a TextEdit.

fixes #902
mickaelistria pushed a commit that referenced this issue Jan 29, 2024
Adds unit test to validate change.

fixes #902
mickaelistria pushed a commit that referenced this issue Jan 29, 2024
Add check in case that end line from edit is larger than the documents
number of lines.

fixes #902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant