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
 Sort lines by ...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Nov 10 2021 :  12:53:47 PM  Show Profile  Reply with Quote
Refactoring code is a pain, sometimes it would be really useful to be able to sort lines by syntactic criteria, like property or value.
Example:

    divPayChecksReceipts.Visible = true;
    btnSelectYear.Disabled = false;
    btnAccept.Disabled = true;
    btnBack.Disabled = false;
    btnClose.Disabled = false;
    btnCloseUser.Enabled = true; 
    btnNew.Disabled = true;
    btnConfirm.Enabled = true; 
    btnNewP.Disabled = true;
    btnValidate.Enabled = false;
Notice those Enabled in the middle of all?
When you got a few dozen of those around, you really may want to sort them by the property (or method), or by the value assigned.

All current line sort methods I found, sort only alphabetically.

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Nov 10 2021 :  1:12:43 PM  Show Profile  Reply with Quote
Well, thinking about it, might even use RegEx for it
like:
\w+\.(\w+)\s*=\s*(\w+)


Sort by group 1 (property) then group 2 (value)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Nov 12 2021 :  08:09:28 AM  Show Profile  Reply with Quote
Interesting, and I do see what you are getting at here. We are considering adding a regex sorting option:

case=97789

its just that there are so many different flavours of regex, and not everyone understands how to use regex. Still, it would be ideal here.

If you run into situations like this fairly often it might be trying one of the IDE macro extensions. This should be the sort of thing that an IDE macro is well suited to doing, depending on how well the extensions work.

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

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Nov 12 2021 :  08:14:22 AM  Show Profile  Reply with Quote
One could of course also use the Roslyn tree to select sorting options, but that might be a far shot. There are some very good regex editors for VS out there, my personal favorite is https://marketplace.visualstudio.com/items?itemName=GeorgyLosenkov.RegexEditorLite which has a great reference guide built in and a testing area.

I might try the macro though.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Nov 15 2021 :  07:54:01 AM  Show Profile  Reply with Quote
Jumping around between different tools and versions of Visual Studio, the different versions of regular expressions sometimes just give me a headache. It's the way the IDE's Find dialog regular expressions are so different that can really irritate. I don't think I have yet seen a tool that would help with the IDE's Find dialog regex syntax.

zen is the art of being at one with the two'ness
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