Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Refactor - sort routines
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

fspafford
Senior Member

USA
45 Posts

Posted - Feb 04 2011 :  12:24:19 PM  Show Profile  Reply with Quote
I work with some tools that create C source files, and the tools are bad about rearranging routines. This makes it more difficult when comparing the files to see what has changed.

It would be nice if VA could rearrange the routines in sorted order.


Regards,

Frank

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Feb 07 2011 :  1:36:29 PM  Show Profile  Reply with Quote
VA Outline is designed to help here, you can use it to simply drag and drop items into the desired order:

http://www.wholetomato.com/products/features/vaoutline.asp

zen is the art of being at one with the two'ness
Go to Top of Page

TudorT
New Member

5 Posts

Posted - Feb 19 2011 :  1:31:05 PM  Show Profile  Reply with Quote
An automatic "Sort Methods Alphabetically" especially when combined with "Sort Methods By Access" type (private/public) would help a lot.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Feb 21 2011 :  12:16:18 PM  Show Profile  Reply with Quote
Based on some of the posts I have read over time, I have the feeling that different people will want their code sorted and grouped differently. For example some people want accessors grouped together.

We don't currently have any plans to try and do this, since sorting is more complex that it first seems, and VA Outline is designed to help you easily keep the files sorted how you want them.

zen is the art of being at one with the two'ness
Go to Top of Page

jay.carlton
Ketchup Master

USA
65 Posts

Posted - Apr 16 2014 :  10:16:09 AM  Show Profile  Reply with Quote
Would it be possible to rearrange a cpp file to match the order of method declarations in the correpsonding .h file? Granted, you'd have to deal with the a class split among multiple translation units, multiple classes per header, and several classes implementing interfaces in the same header, but in the common case of one header for each class file, it would seem like a natural way to order the implementation file. You'd probably also want an option to put static functions stuff at the top of the cpp file.

Eventually you might want some kind of template or rearrangable pattern to describe the standard for how classes should be laid out. This is one area where C++ gives you too much flexibility, and it's hard to maintain things in any particular way.

You'd probably also need a rule saying that anything in a COM interface has to stay in its original order, or automation clients relying on the layout of your virtual function tables would break.

But any solution to this problem would ideally need to keep the header synchronized with the cpp file.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Apr 16 2014 :  11:39:57 AM  Show Profile  Reply with Quote
Sorting the cpp file to match the header file is something we are looking into doing:

case=56425

As you say, there are a number of edge cases to consider, just for a change Keeping the two files in the same order is something we are considering, at least if you are using VA refactoring commands. For example, we are looking to make Move Implementation to Source File more order aware, but since we cannot assume the two files are actually in the same order, we are looking at just the surrounding functions for this:

case=12454

zen is the art of being at one with the two'ness
Go to Top of Page

hackish
New Member

2 Posts

Posted - May 08 2014 :  4:18:59 PM  Show Profile  Reply with Quote
While I understand the need to build a sort feature that would appeal to everyone, I would love it if I could select some or all of a class and have it automagically sort. If you wanted to extend this to cover more cases then maybe allow the user to supply a regex for the sort order. So for those who want their get/set methods grouped together they could consider something like /[gs]et.*/
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - May 10 2014 :  6:51:49 PM  Show Profile  Reply with Quote
Are you aware that you can manually sort a part of a file using VA Outline, which supports both drag and drop via the mouse, and cut and paste:

http://docs.wholetomato.com/default.asp?W187

Sorting just part of a file, assuming you want both the header and cpp files to be in the same order, is if anything more complex than sorting the whole file, since the part of the file you are sorting may not be grouped together.

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Feb 13 2015 :  8:17:37 PM  Show Profile  Reply with Quote
case=12454 is fixed in build 2059
Go to Top of Page

pwc
Tomato Guru

138 Posts

Posted - Jul 23 2015 :  6:06:10 PM  Show Profile  Reply with Quote
Sorting the cpp file to match the h file would be great.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000