Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Syntax coloring

Former Member
0 Likes
5,879

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

1 ACCEPTED SOLUTION
Read only

LukaszPegiel
SAP Champion
SAP Champion
0 Likes
5,588

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.

19 REPLIES 19
Read only

LukaszPegiel
SAP Champion
SAP Champion
0 Likes
5,589

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.

Read only

0 Likes
5,588

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.

Read only

matthias_becker
Product and Topic Expert
Product and Topic Expert
0 Likes
5,588

Hi Lukasz,

it may be OT: What Theme are you using in your screenshots?

Regards,

Read only

0 Likes
5,588

Eclipse Dark theme + own color settings. You can download them from here: http://abapblog.com/articles/how-to/78-aie-dark-theme-settings

Read only

0 Likes
5,588

This is not possible yet in ADT but can probably put it on backlog list?

Read only

ThFiedler
Product and Topic Expert
Product and Topic Expert
0 Likes
5,588

Does something like this IndentGuide would help.

Regards,

Thomas.

Read only

0 Likes
5,588

I think this would be perfect

Read only

0 Likes
5,588

Exactly!

I'll also give Thomas' suggestion with the plugin a try. I think it could help as well.

Read only

0 Likes
5,588

Hello Johannes,

you can close your discussion, as has shown yesterday 

Cheers

Łukasz

Read only

0 Likes
5,588

Thanks for the hint. Didn't notice that.

Exactly what I wished for.

Read only

pokrakam
Active Contributor
0 Likes
5,588

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

Read only

Former Member
0 Likes
5,588

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.

Read only

0 Likes
5,588

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

Read only

0 Likes
5,588

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

Read only

0 Likes
5,588

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

Read only

0 Likes
5,588

Hi Michael,

Yes, that would be great and exactly cover my requirements!

Cheers,

Johannes

Read only

0 Likes
5,587

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.


  • AMDP-Methods: Currently you can set the background color for embedded languages as shown in the image below. We could also do the same for "normal" methods, forms, function modules etc.. We could also include the METHOD/ENDMETHOD statements in the highlighting.

  • Enhancements: For enhancements we also do some background highlighting. In this case we do "inverse"-highlighting, i.e. we change the background color of the code that doesn't belong to the block. The code belonging to the block is then easy to identify.

Any opinions on this? Any preferences amongst the alternatives?


Kind regards

Chris

Read only

0 Likes
5,587

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

Read only

0 Likes
5,587

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