Community
Participate
Working Groups
The token returned by WhitespaceRule should be customizable. The background is that this can help reduce the amount of style ranges created by the DefaultDamagerRepairer. Subsequent equal style ranges are merged while scanning the text. This is hindered by the whitespace token which does not contain a text attribute and the default text attribute of the DefaultDamagerRepairer in general does not match the text attribute of the default return token of the scanner. The result is that much more style ranges are created than necessary. E.g. in the case of the Java editor, for StyledText.java currently 86620 style ranges are created, but only 57752 when exploiting this little optimization.
Created attachment 115391 [details] New constructor This adds a new constructor to WhitespaceRule taking the custom token.
>The result is that much more style ranges are created than necessary. >E.g. in the case of the Java editor, for StyledText.java currently 86620 style >ranges are created, but only 57752 when exploiting this little optimization. Anton, could you also add this to the patch (including for Properties file editor)?
Created attachment 115548 [details] Patch against JDT This patch enables the optimization for the Java editor. The Properties file editor is different in that it does not define an "Other" highlighting category. So I don't see an easy way to improve things there.
Created attachment 115552 [details] Patch against JavaCodeScanner only I forgot to change the JavaDocScanner also. The number of style ranges are (with default highlighting preferences): - 75477 ranges before applying the patch - 12893 after applying the patch These are the numbers for plain syntax highlighting. Of course, semantic highlighting increases this number later on.
Wow, you're fast: I was just about to ask for the Javadoc scanner ;-) However, the new patch seems to be a copy of the first one. I've committed the first and second patch with some small changes: - the field needs to be protected because the class can be subclassed by clients - improved Javadoc for evaluate(...) - added the following copyright entry: Anton Leherbauer (Wind River Systems) - [misc] Allow custom token for WhitespaceRule - https://bugs.eclipse.org/bugs/show_bug.cgi?id=251224 Thanks for your help!
(In reply to comment #5) > Wow, you're fast: I was just about to ask for the Javadoc scanner ;-) However, > the new patch seems to be a copy of the first one. Maybe I was too fast ;-) Thanks!
Created attachment 115556 [details] Patch against JavaDocScanner only Second try.
Committed the latest patch to HEAD. Available in builds > N20081019-2000.