jogu_dl
jogu_dl

Reputation: 35

How to highlight function in all project with Eclipse (C/C++) by default?

This is the use case: You have a project where specific function is being called all over the files, you don't care about it but visually sometimes is annoying. Is there a way to highlight occurrence of this specific function by default in the project?

I tried looking at eclipse preferences, TextEditor>Syntax Coloring. You can change colors of functions, enums, variables, etc. but not specific function. Mark Occurrences also not good for this use-case since no matter what you search for, I would like to see this function with diff color.

Example:

careless_func_check(arg1, arg2, arg2);
MyImportantFunction1(arg1);
careless_func_check(arg1, arg2, arg2);

careless_func_check(arg1, arg2, arg2);
MyImportantFunction2(arg1);
careless_func_check(arg1, arg2, arg2);

careless_func_check(arg1, arg2, arg2);
MoreNiceFunctions___1(arg1);
careless_func_check(arg1, arg2, arg2);

careless_func_check(arg1, arg2, arg2);
MyImportantFunction__2(arg1);
careless_func_check(arg1, arg2, arg2);

When certain code is not compiling, the code will be highlighted to different color (e.g. pink) to facilitate you distinguish it. I would like to process the function above: "careless_func_check" to be highlighted with other color, so for me would be easier to look at the code (careless_func_check is used in the code, just not important to me).

Any idea if it is possible?? I know is an specific nice-to-have option but wanted to try here to see if someone knows.

Upvotes: 2

Views: 1024

Answers (1)

Chandrayya G K
Chandrayya G K

Reputation: 8849

Check these two ways:

File wide

Change the mark occurrences annotations background color/Text preferences as shown below.

enter image description here

But it applies to every occurrences ex; variable, functions etc not limited to your own function.

Project/workspace wide(Changing search results annotations background color)

Change the Search result occurrences annotations background color/Text preferences[Refer above image].

Then search your function careless_func_check in C/C++ search dialog(Search > C/C++). Remember search result will be highlighted till next search or manual removal of search results in Search view.

enter image description here

Upvotes: 1

Related Questions