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
 switch enum completion
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

znakeeye
Tomato Guru

379 Posts

Posted - Sep 25 2009 :  05:09:45 AM  Show Profile  Reply with Quote
I want VAX to produce this (using a shortcut/command or whatever):

switch (myEnum)
{
case enumValue1:
    break;
case enumValue2:
    break;
...
case enumValueN:
    break;
}


Shouldn't be too hard?

sean
Whole Tomato Software

USA
2817 Posts

Posted - Sep 25 2009 :  11:02:57 AM  Show Profile  Reply with Quote
We're thinking about this, but aren't sure of the best way to trigger it. You type myEnum and exec a command to produce the whole switch statement? case=19137
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Sep 25 2009 :  11:20:02 AM  Show Profile  Reply with Quote
For now the new scoped suggestions will suggest the enum items after each "case" keyword, making it a lot easier to write these switch statements manually.

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

znakeeye
Tomato Guru

379 Posts

Posted - Sep 28 2009 :  03:19:06 AM  Show Profile  Reply with Quote
A possibility is to show a "VAX paste menu" when you complete the first case-statement, similar to this:
enum MyEnum { myEnum1, myEnum2, myEnum3 };
switch (myEnum)
{
case my

shows:
[ myEnum1 ]
[ Complete all MyEnum constants ]
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Sep 28 2009 :  09:18:03 AM  Show Profile  Reply with Quote
I am not sure I understand. Do you mean the second item in the menu would trigger the refactoring command?

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

znakeeye
Tomato Guru

379 Posts

Posted - Sep 29 2009 :  04:46:58 AM  Show Profile  Reply with Quote
I mean that the last menu item should fill the switch-statement with the remaining enum items!

switch (myEnu|
Menu is shown with all current alternatives + "Add all myEnum constants" to produce the complete switch-statement!

Or, if I later type "case":

switch (myEnum)
{
case myEnum1:
    break;
case my|
Menu is shown with all current alternatives + "Add all myEnum constants" to produce the complete switch-statement!

// Complete switch statement would look something like this:
switch (myEnum)
{
case myEnum1:
    break;
case myEnum2:
    break;
case myEnum3:
    break;
default:
    // ASSERT(FALSE);
    break;
}


For enums with no name (e.g. enum { a, b, c };) you obviously need to change the string "Add all myEnum constants" to "Add all related enum constants" or similar. You do the English! :P
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Oct 01 2009 :  09:01:22 AM  Show Profile  Reply with Quote
This makes sense. I have added a note to case=19137 about this.

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 - Aug 21 2015 :  12:26:57 AM  Show Profile  Reply with Quote
case=19137 is implemented in build 2073 as the command "Add Missing Case Statements"
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