Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Refactiong: create method and move to base classe

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
SnowBoy Posted - Oct 10 2008 : 04:30:03 AM
Hi.

Actually I use VS2003 with C#, but I've had a chance to use VS2005.
I found really useful the feature that creates a new method simply by writing it into the code.
For example:

{
  ICollection dataCollection = ...;

  Int32 startIndex = ...;
  Int32 endIndex = ...;

  // I write this line of code:
  updateDataCollection(dataCollection, startIndex, endIndex);
  
  ...
}

Hovering above updateDataCollection, the new command creates:

private void updateDataCollection(
 ICollection dataCollection, 
 Int32 startIndex, 
 Int32 endIndex)
{
 // Add your code here 
}


Another useful feature could be the "Move to base classe" for a class method.
For example:

public class DerivedClass : BaseClass
{
  protected void myMethod() // Note: maybe the feature could be enabled only if myMethod is declared as protected
  {
  ...
  }

  ...
}

public class BaseClass
{
  ...
}


Hovering above myMethod will show also the "Move to Base Class" feature, that allows to move the method to the base classe.

public class DerivedClass : BaseClass
{
  ...
}

public class BaseClass
{
  protected void myMethod() 
  {
  ...
  }
}


It's possible to add this two feature to Visual Assist X?
Thanks.

This software rocks. When my trial expired, I've bought it immediately because I wasn't able to work without it anymore. It's a pain when I work on a system where it's not installed.
6   L A T E S T    R E P L I E S    (Newest First)
SnowBoy Posted - Oct 14 2008 : 07:18:38 AM
Ok, it's clear.
VA Outline shows only the code of the current file, and lets to navigate into it. In fact I think that this feature, if added, could bring some problems: if the Class, Interface, aren't included in the current project? Where should point selecting them?
Anyway, as I said before, it's possible to reach these objects throught the "Goto Definition". I'll still work in this way, as I'm used to do.

Hence, don't think about this anymore. I'll wait for case=2451, that's really more useful. :)

Thanks for your support.
Bye
feline Posted - Oct 14 2008 : 05:32:43 AM
For VA View try this C# code instead:

    class testGrandparentClass
    {
        void GrandParentOne() { }
        void GrandParentTwo() { }
    }

    class testParentClass : testGrandparentClass
    {
        void ParentThree() { }
        void ParentFour() { }
    }

    class testChildClass : testParentClass
    {
        void ChildFive() { }
        void ChildSix() { }
    }


here when I show testChildClass in VA View both parent classes are listed. It seems VA View is ignoring empty classes, which is not totally unreasonable.

I see your point about navigation from within VA Outline, but where does this idea stop? A common request is to move classes / functions to another file. Often this is because someone is creating a new class and splitting the code between two classes. Or perhaps they are moving code between a cpp and .h file. Maybe they are moving code between a .cs and .vb file.

All of these are situations where using VA Outline to cut the code is useful, but navigating to any of these places via VA Outline is not really reasonable. As soon as VA Outline shows things that are not part of the current file then we will have problems with drag and drop, and VA Outline will become more confusing / less clear and focussed.
SnowBoy Posted - Oct 13 2008 : 11:47:54 AM
No problem about the move to a base class feature. It could handled via VAOutline, and there's no need to add it.


My last feature request, however, it's not supported by VA View. Throught the windows of VAX there's no way to reach the base class and interfaces of a class.

In your example, both testParentClass and testGrandparentClass aren't directly accessible in VA View, even if the window shows them. However, when I clik the left arrow on the keyboard I could use the Enter key to reach their methods and members. Also, even from the VAOutline window these classes aren't reachable.

What could be useful is the ability to go to testParentClass (and hence to testGrandparentClass) throuht VAOutline.

This helps to complete the following task starting from VAOutline window:
1) select and copy/cut a class member or method
2) use the arrow keys to reach the list of base class (only one is visible) or interfaces
3) press the Enter key to open the selected class
4) copy the code

I hope to have give you a good explanation.

Bye
feline Posted - Oct 13 2008 : 10:57:03 AM
I think we may be talking about different things. This very simple piece of C# code compiles for me in VS2005:

    class testGrandparentClass {}

    class testParentClass : testGrandparentClass {}

    class testChildClass : testParentClass {}


if I have a method in [COLOR=blue]testParentClass[/COLOR] and say move to a base class, then which base class? There are two of them. I believe you can also do something that looks like multiple inheritance via multiple Interface's. It won't take long for someone to ask for "move to parent interface". In fact the request has probably already been made somewhere in the forum history

Have you tried the bottom half of VA View:

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

this should help, since it is designed to show you some information about the class hierarchy.
SnowBoy Posted - Oct 13 2008 : 08:28:50 AM
case=2451
Thanks!
We're out there to test and improve the new features. :)

For the other request...
Yes, you're right: it could be a problem when you've to move the function to the base class, but with C# there's only one of them. Anyway, VAOutline helps to do the work.
However, a nice feature (especially when there's a great use of the keyboad shortcuts) could be the access to the base class and interfaces thorought VAOutline. In other words, the window lists: 1) using directives, 2) class methods, 3) class members and also 4) objects from which the class itselft inherits.
In this way, when I'm in the window I could reach any of this elements with the Enter key.
Actually, instead, to reach base class and interfaces I've to go the the declaration line, select the object and finally go to it's implementation.
feline Posted - Oct 10 2008 : 8:12:00 PM
We are considering adding a command to create a function from the function call:

case=2451

The tricky part is working out the parameter types.

Moving a function to a base class is an interesting thought, but when you consider several base classes, or alternatively multiple inheritance this starts to get quite complex. Plus there is the fun with class member variables.

This is where VA Outline is helpful, since you can use Cut in the Outline window to grab the function and then simply paste it into the appropriate base class.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000