Skip to content

Commit

Permalink
Return OK_STATUS from the semantic highlighting job when the editor…
Browse files Browse the repository at this point in the history
… is dirty.

Previously, we announced that the job finishes asynchronously (`ASYNC_FINISH`),
but forgot to call `done` if the editor was dirty (and no UI asyncExec was
performed at all). This lead in turn to the job manager thinking that the job
is still running and not scheduling another run, ever, meaning the loss of
semantic highlighting.

Fixed #1001536.
  • Loading branch information
dragos committed Mar 8, 2013
1 parent 9b54cab commit 5e51152
Showing 1 changed file with 10 additions and 8 deletions.
Expand Up @@ -131,20 +131,22 @@ class Presenter(

if (damagedRegion.getLength > 0) {
val sortedPositions = newPositions.sorted.toArray
runPositionsUpdateInUiThread(sortedPositions, damagedRegion)
Job.ASYNC_FINISH
/* if the positions held by the `positionsTracker` have changed, then
* it's useless to proceed because the `newPositions` have computed on a
* not up-to-date compilation unit. Let the next reconciler run take care
* of re-computing the correct positions with the up-to-date content.
*/
if (!positionsTracker.isDirty) {
runPositionsUpdateInUiThread(sortedPositions, damagedRegion)
Job.ASYNC_FINISH
} else Status.OK_STATUS
}
else Status.OK_STATUS
}(Status.OK_STATUS)
}

private def runPositionsUpdateInUiThread(newPositions: Array[Position], damagedRegion: IRegion): Unit =
/* if the positions held by the `positionsTracker` have changed, then
* it's useless to proceed because the `newPositions` have computed on a
* not up-to-date compilation unit. Let the next reconciler run take care
* of re-computing the correct positions with the up-to-date content.
*/
if (!positionsTracker.isDirty) uiThread.asyncExec {
uiThread.asyncExec {
try {
setThread(uiThread.get)
if (!positionsTracker.isDirty) {
Expand Down

0 comments on commit 5e51152

Please sign in to comment.