eclipse / lsp4e

Language Server Protocol support in Eclipse IDE
Eclipse Public License 2.0
61 stars 54 forks source link

Blank editor after formatting source code via LS #902

Closed ghentschke closed 7 months ago

ghentschke commented 7 months ago

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.