Skip to content

Conversation

@FlorianKroiss
Copy link
Contributor

Unfortunately, the fix in #1444 was incomplete, because the call to normalizedOffset can also run into a BadLocationException if the document has changed since the job was scheduled:

org.eclipse.jface.text.BadLocationException: null
	at org.eclipse.jface.text.AbstractDocument.getChar(AbstractDocument.java:774)
	at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getChar(SynchronizableDocument.java:236)
	at org.eclipse.lsp4e.operations.highlight.HighlightReconcilingStrategy.normalizedOffset(HighlightReconcilingStrategy.java:332)
	at org.eclipse.lsp4e.operations.highlight.HighlightReconcilingStrategy.collectHighlights(HighlightReconcilingStrategy.java:213)
	at org.eclipse.lsp4e.operations.highlight.HighlightReconcilingStrategy.lambda$0(HighlightReconcilingStrategy.java:138)
	at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:187)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Fix: Let normalizedOffset throw the BadLocationException and move normalizedOffset() after the document modification check and inside the try block, so that the BadLocationException is properly handled.

@rubenporras rubenporras merged commit 8e533ff into eclipse-lsp4e:main Dec 5, 2025
11 checks passed
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 this pull request may close these issues.

2 participants