For source code, display function declaration

Post your new features ideas and suggestions here.
Post Reply
Buurmas
Posts: 3
Joined: Wed Feb 04, 2009 4:20 pm

For source code, display function declaration

Post by Buurmas »

Thanks for your great product. All our developers use Compare It!

We have been using it (among other things) for C++ code reviews. It does a great job of taking us right to the change. But then the question always follows: "Wait, what function are we in?" We page up and locate the function and then go back to the change. It would be really slick if Compare It!, when in a function block (i.e., between curly braces for C++: return_value functionname(parms){ }), could have an option to show "return_value functionname(parms)" on some toolbar.

Thanks for your consideration.

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

Thank you for suggestion! IN fact this feature is already in my wish list for a quite long time. I will do it soon.

Buurmas
Posts: 3
Joined: Wed Feb 04, 2009 4:20 pm

Thank you!

Post by Buurmas »

Thank you! And thanks again for a very useful product.

Buurmas
Posts: 3
Joined: Wed Feb 04, 2009 4:20 pm

Thinking about this more

Post by Buurmas »

It seems like one trickiest part here is, given a line of code, identifying the preceding function. And it's language dependent. For C++, I think you want to look for a pattern like this:

ReturnValue FunctionName(*)*{

... where * are wildcards. FunctionName might be ClassName::FunctionName, but it should be one term without spaces either way. ReturnValue and FunctionName cannot contain a semicolon or parentheses or brackets. I think that is good enough to distinguish between statements like this:

if(*)*{

... as well as class or namespace designations:

class ClassName*{
namespace NameSpaceName*{

Maybe CompareIt! could simply locate this pattern appearing on or before the highlighted line of code and display it on a status bar or something. To make it language-specific and associated with the appropriate file extensions, the pattern could be entered in Options / Options / File Filters. If you wanted to make the setting broader than "function name" you could call it "context identifier" or something. You could even make it the user's responsibility to construct a regular expression to identify the pattern if you wanted.

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

That's right - but do not forget that I do full syntax coloring, so I parse file anyway. I just need to tweak it a bit.

Post Reply