2015 Dec 01 10:32 AM
Hi all,
Is there any way to change the syntax coloring of ABAP in eclipse beyond the possibility to change the color of, e.g., all keywords? What I want to achieve is to color certain keywords in a different way than most keywords. In particular, I want to have METHOD and CLASS colored in a different way from the remaining keywords. This would make finding methods and local classes much easier.
By the way, from what I know from my colleagues, one major reason preventing them from changing from SAP GUI to Eclipse is that they find it hard to visually separate the different methods from each other - which is easier in SAP GUI, even in source code representation, because of the horizontal line which is drawn between the methods. Having something like this in Eclipse would also be very helpful (and would actually make my syntax coloring request obsolete).
Cheers,
Johannes
2015 Dec 01 10:56 AM
I guess this coloring is not possible, but what do you mean about reading problem between methods? You can set marker color to any you want so it will show you beginning and end of method, additionally you got info about where you are in breadcrumbs.
2015 Dec 01 10:56 AM
I guess this coloring is not possible, but what do you mean about reading problem between methods? You can set marker color to any you want so it will show you beginning and end of method, additionally you got info about where you are in breadcrumbs.
2015 Dec 01 11:53 AM
Thanks for your answer. Setting the marker to a more eye-catching color is already a helpful hint. What I'd like to have, though, is such a marking that is always visible and not only when the cursor is inside the method.
2015 Dec 01 12:01 PM
Hi Lukasz,
it may be OT: What Theme are you using in your screenshots?
Regards,
2015 Dec 01 12:04 PM
Eclipse Dark theme + own color settings. You can download them from here: http://abapblog.com/articles/how-to/78-aie-dark-theme-settings
2015 Dec 01 12:20 PM
2015 Dec 01 12:45 PM
2015 Dec 01 12:57 PM
2015 Dec 01 1:05 PM
Exactly!
I'll also give Thomas' suggestion with the plugin a try. I think it could help as well.
2016 Apr 02 8:46 PM
2016 Apr 08 5:10 PM
Thanks for the hint. Didn't notice that.
Exactly what I wished for.
2015 Dec 01 9:06 PM
Hi Johannes,
Re. Separating methods: It's easy to overlook the outline view (bottom left in the default perspective). Takes a little effort of getting used to looking at it, but I actually find it very useful to fulfil the same purpose.
It follows you as you navigate through the code so you always know exactly where you are, or you can click on objects to jump straight there.
Regards,
Mike
2015 Dec 02 9:39 AM
Hi Mike,
Your absolutely right, the outline is an important tool I already make heavy use of. I still wish I could color up my source code a little more, e.g., in the way Lukasz has shown with his screenshot from the Java properties.
2015 Dec 11 9:19 AM
Hi Johannes,
currently we are discussing a quite generic feature and we would like to know how it fits to your requirements:
We want to provide a section in the preferences called keyword coloring where you could choose any keyword like METHOD, ENDMETHOD, EXIT, SELECT, RAISE EXCEPTION, FOR ALL ENTRIES or whatever keyword you want and assign a certain color and maybe also stuff like italic, bold and so on.
The syntax coloring would consider these settings. The default color would be used for all other keywords.
We believe that this would cover a bunch of requirements maybe also yours 😉
What do you think?
Regards,
Michael
2015 Dec 11 9:49 AM
Hi Michael,
I think that sounds great. Would it also be possible to have member variables of classes in a different color than other variables?
Regards
Florian
2015 Dec 11 9:59 AM
Hi Florian,
well, I would like to have this feature as well, but it would be more difficult to implement. And I assume that it would also have significant negative impact on performance.
Regards,
Michael
2015 Dec 11 10:17 AM
Hi Michael,
Yes, that would be great and exactly cover my requirements!
Cheers,
Johannes
2015 Dec 11 11:45 AM
Hi Johannes,
as you know, "many roads lead to rome" ;-).
We are currently discussing your requirements internally and there are, of course, also other alternatives. Michael has already mentioned one. If we focus on your statement: "... they find it hard to visually separate the different methods from each other ...", then we could also utilize some already existing ADT concepts to improve the situation. In particular we could perform some background highlighting, similar to how it is done for embedded languages (SQLScript) in AMDP-methods or how it is done for enhancements.
Any opinions on this? Any preferences amongst the alternatives?
Kind regards
Chris
2015 Dec 11 1:40 PM
Hi Chris,
If I may add my 2p, the problem with both of these ideas is that it doesn't help when skimming through code, which was what the OP's indicated.
When I have my cursor in a method, I already have a closer focus and am aware of the begin and end, thus less of a need for the hilighting. So while those options are not without merit, they don't make my 'must have' list. Some may find it useful but I would probably find it distracting and turn it off.
Perhaps a line hilight option for modularisation keywords could work? Similar to how it's possible to e.g. define the background color for the current line or an error line in the SAPGUI editor. So any line starting with METHOD ENDMETHOD FORM ENDFORM could have a custom background color for the whole line.
Regards,
Mike
2015 Dec 11 2:07 PM
Hi Chris,
These are also interesting options.
I'd prefer the AMDP-like option, but I think that user-adjustable colors are particularly important here, since the colored areas will be quite large. It would be helpful, if the general background color setting of eclipse remains respected, which would allow us to set, e.g., the background color to lightgrey and the method color to white. In addition, I'd prefer to include the METHOD/ENDMETHOD statements in the colored area.
In the second option, the main disadvantage for me is that only the focused method would be highlighted. As Mike pointed out, highlighting the begin and end of the active method is already possible by today. Your proposed inverse highlighting might be a bit clearer, though.
However, if I'd have the choice between these two options and the enhanced syntax coloring options, I'd go for the syntax coloring.
Best,
Johannes