Changing strikethrough deprecated symbols option doesn't update the editor
If the option
Preferences → Scala → Syntax coloring → Strikethrough deprecated symbols
is changed the editor isn't updated.
Leave a comment
on 2013-03-11 16:15 *
By Mirco Dotta
Good catch! This is most likely a regression I introduced while re-working the semantic highlighting implementation :)
on 2013-03-11 17:15 *
By Simon Schäfer
Do you have an idea where this can crash? I tried to fix it but had no luck in finding the location of the bug.
on 2013-03-11 17:15 *
By Simon Schäfer
(Comment removed)
on 2013-03-11 18:17 *
By Mirco Dotta
Yes, I believe the problem is that we do not react to the property change linked to the strike through preference. The fix would involve listening for that property here and invalidate the text presentation region that contains the position whose styles need to be updated.
Basically, in propertyChange you need to add something like:
I'm not suggesting you should implement it the way I described (it would be desiderable if we don't have to go through the N positions when computing deprecatedPositions, as this code is running in the UI Thread and user could feel the slow down if N is big enough). I was just trying to make my above explanation real by showing some code. Let me know if you have any question.
Basically, in propertyChange you need to add something like:
if(event.getProperty.equals(ScalaSyntaxClasses.STRIKETHROUGH_DEPRECATED)) {
val deprecatedPositions = positionsTracker.deprecatedPositions() // this method doesn't exist. Furthermore, positions tracked by ``positionsTracker`` are sorted
// I'm assuming deprecatedPositions.size > 1, of course that's not true in general. I only take head and last because positions are sorted
val dirtyRegion = new Region(deprecatedPositions.head.offset, deprecatedPosition.last.offset + deprecatedPosition.last.length)
sourceViewer.invalidateTextPresentation(dirtyRegion.getOffset, dirtyRegion.getLength)
else {
// old implementation of propertyChange
}
I'm not suggesting you should implement it the way I described (it would be desiderable if we don't have to go through the N positions when computing deprecatedPositions, as this code is running in the UI Thread and user could feel the slow down if N is big enough). I was just trying to make my above explanation real by showing some code. Let me know if you have any question.
on 2013-03-19 03:48 *
By Simon Schäfer
Thanks Mirco, your description helped a lot. I could fix the problem. I just need to do some benchmarks on large files and if it is fast enough the PR will follow.
on 2013-03-19 08:23 *
By Mirco Dotta
Cool!
on 2013-03-19 18:54 *
By Simon Schäfer
Description changed from If the option Prefere... to If the option Prefere...
Ticket assignment reverted due to inactivity.
on 2015-03-27 18:11 *
By Simon Schäfer
Version changed from 3.0.0-RC2-210 to 4.0.0
Milestone changed from Helium SR1 to -none-