Sounds like you've made some pretty good progress.

There's https://github.com/emilianbold/netbeans-releases which is a git repository of the old netbeans stuff. And there's http://source.apidesign.org/hg/netbeans/ which has old mercurial repositories.

I haven't looked at highlighting for a long time, I seem to recall that OffsetsBag had quite a bit of functionality (and I could be miss-remembering); threading/listeners/... Implementing your own, rather than using OffsetsBag, sounds risky and bug prone and extra work. Why did you make that choice?

I'm lazy, I'd probably start with the whitespace implementation. Maybe

1. copy whitespace and just do EOL with it
2. starting with 1. evaluate incorporating it into whitespace.


Possibly 1. could be made into a plugin to get some feedback, then roll that into NB proper or merge it into whitespace.

-ernie

On 6/23/2020 2:48 PM, Dmitry Semikin wrote:
Hello Everyone,

The topic does not seem to attract too much attention, but I hope, it is just 
lack of time. It is the same for me, so the progress does not go as fast as I’d 
like it to…

Nevertheless, meanwhile I updated the example implementation, so that it 
implements now HighlightsContainer directly instead of using OffsetsBag. If 
someone is interested it is still available on GitHub here: 
https://github.com/DmitrySemikin/nb-eol-highlighter

Besides after some wandering around in the depths of NetBeans projects I found, 
where the highlightings for whitespaces are implemented. The following files 
are involved:

HighlightsContainer implementation for Whitespaces:
netbeans\ide\editor.lib2\src\org\netbeans\modules\editor\lib2\highlighting\WhitespaceHighlighting.java
Corresponding factory:
netbeans\ide\editor.lib2\src\org\netbeans\modules\editor\lib2\highlighting\Factory.java
Registration of the factory is done in the following layer.xml:
netbeans\ide\editor.lib2\src\org\netbeans\modules\editor\lib2\resources\layer.xml
Specification of the categories (~FontsAndColors.xml)
netbeans\ide\editor\src\org\netbeans\modules\editor\resources\NetBeans-editor.xml
It's virtual path in Layer.xml:
Editors/FontsColors/NetBeans/Defaults/org-netbeans-modules-editor-highlight-colorings.xml
Layer.xml, in which NetBeans-editor.xml is actually registered:
netbeans\ide\editor\src\org\netbeans\modules\editor\resources\layer.xml
Localization of the category-names shown in options dialog
netbeans\ide\editor\src\org\netbeans\modules\editor\Bundle.properties
So I see two possibilities, how the EOLs could be treated:

- Handle them together with whitespaces in WhitespaceHighlighting.java.
- Or create separate HighlightsContainer specifically dedicated for EOLs.

Could someone suggest, which approach is better? I personally would rather go 
with the second one for two reasons: first, then I would use the solution, 
which I already have. Second, if something goes wrong, it is more independent, 
so it is easier to remove the changes.

I tried to check, who did the changes to the mentioned files recently, but it 
seems, that they were not modified since the donation of the source code to 
Apache Foundation. I don’t see the history further backwards. Original authors 
of those two classes are Miloslav Metelka and Vita Stejskal. If these people 
are still involved in the development, probably they could give me some advice.

I would be very grateful to anyone, who could give any comment or advice.

With kind regards,
Dmitrii Semikin.



On 2020/06/15 21:33:07, Dmitry Semikin <[email protected]> wrote:
Hello Everyone, hello Christian,

Thank you for your hint. Looking at the module you pointed to and at “NetBeans 
Mark Occurrences Module Tutorial” I put together a module, which kind of does 
the job. It is not yet completely ready, but I have couple of technical and 
organizational questions:

- In the provided example the font settings are retrieved using 
“org.netbeans.api.settings.FontColorSettings.getFontColors()”. But I cannot 
easily find, where can I add my own setting “EOL”, so that it is configurable 
from the Options dialog?
- When I change the background of the EOL symbol, this background spans till 
the very right edge of the text editor. Is it expected? In my opinion it does 
not look nice. Can it be fixed somehow? I tried to pass the option 
HighlightsContainer.ATTR_EXTENDS_EOL = Boolean.FALSE, but it did not help.
- Which Z-Order would be reasonable for EOL?
- HighlightsLayer.create() function takes as input “fixedSize” parameter, 
which, if I understand it correctly should tell they system, if the text-size 
may change as a result of highlight. In my understanding this depends on the 
AttributeSet used. My question is: is there some utility function, which would 
define “fixedSize” parameter based on provided AttributeSet, i.e. return 
“true”, if the AttributeSet explicitly contains font family or font size etc.?

Another couple of question related to integration to Netbeans:
- If this functionality is going to ever be integrated into Netbeans, how 
should it be implemented: as separate module, or as part of existing module?
- If existing module, which one?
- If new module, what is naming convention for the module and for the package 
(suggestions for the specific names would be nice).
- Are any automated tests needed for this particular case? What is considered 
to be useful to test?

The actual state of the module is available here:
https://github.com/DmitrySemikin/nb-eol-highlighter

Any additional suggestions and critics are very welcome.

My further planned step for now is to replace implementation, which re-scans 
whole file for every change with the implementation, which only checks the 
changed fragment of text. Then try to figure out myself (or with the help of 
the answers, if any), how to specify colors using options dialog.

Thanks in advance for any kind of comments.

Dmitrii.

On 2020/06/09 08:05:28, Christian Lenz <[email protected]> wrote:
Hey Dimitrii,

cool to hear that you want to work on it. Maybe you can find some more insights 
in this plugin too: 
https://github.com/tunnelvisionlabs/goworks/tree/master/tvl.editor.whitespace


Cheers

Chris


Von: Dmitrii Semikin
Gesendet: Dienstag, 9. Juni 2020 08:29
An: [email protected]
Betreff: Re: NETBEANS-1678: Option for coloring EOL - Could someone point at 
similar code?

Hello once again,

I did some digging and I hope, I realized the general idea about coloring. There are 
categories of tokens defined in Lexer of specific language. And there are 
"fontsColors.xml" files, which provide mapping of the categories of tokens to 
particular color. They also provide the list of coloring categories for the Options 
dialog.

So, to provide option for the coloring of EOLs separately one would need to:
- Introduce new category of tokens in the language lexer (ultimately, in lexers 
for each language, if we want to have this feature in every language).
- Adjust "fontsColors.xml" to provide coloring-category and default values for 
the color.

Could someone confirm, that my understanding is correct (or point out that it 
is not correct, maybe providing also some hint about what exactly is wrong)?

Could someone also tell, if it is a good idea to modify lexers for languages 
e.g. like Java (being honest I did not look at the implementation yet)?

Thank you in advance.
Dmitrii.


On 2020/06/06 15:54:25, Dmitrii Semikin <[email protected]> wrote:
Hello  Everyone,

There is an issue: NETBEANS-1678 : Option for coloring EOL 
(https://issues.apache.org/jira/browse/NETBEANS-1678).

I prefer to have whitespace characters on, but find it annoying, that EOL is 
displayed with the same color as normal text - balck (too bold for me).

I woud probably try to implement this feature. So I would be greatful, if 
someone could point me to the place in code, where some similar coloring 
feature is already implemented (it would also increase chances, that it will be 
done :)). Also any addiitional ideas, suggestions or advices regarding the 
implementation would be very appreciated. I should say, that I have some idea 
about development for NB platform, but I am still rather inexperienced.

Thank you in advance.

Dmitrii.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists






Sent from Mail for Windows 10




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to