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
 Member move to...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2233 Posts

Posted - May 09 2022 :  1:53:45 PM  Show Profile  Reply with Quote
Sometimes I find the need to move a class member from the main file to a related file where a partial class is located. Like for example ASP.NET controls, move em from the .designer.cs file to another file, so I can alter documentation comments or types and they wont be regenerated when altering the .aspx file.
So, selecting one or more members of a class I would like to be able to select a "Move to" with a selection of related files, or create a new related file. With the associated comments and required usings.
Strangely I didn't find any extension that does that.

feline
Whole Tomato Software

United Kingdom
17886 Posts

Posted - May 10 2022 :  06:53:50 AM  Show Profile  Reply with Quote
We are considering adding the ability to move a member function to another class, but considering C# partial classes is an interesting variation on the idea.

If the partial class already exists, and has two, or more, implementations then producing a list of them is well defined. Are you considering the situation where the partial class only has one implementation though, or wanting to add a new implementation, and file, to an existing partial class?

I want to understand what you are thinking here, since partial classes are going to require some slightly different handling.

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

Uniwares
Tomato Guru

Portugal
2233 Posts

Posted - May 10 2022 :  08:31:37 AM  Show Profile  Reply with Quote
I can come up with the following scenarios (for C#):

1) existing: one file with a class not partial
a) move members to a NEW related/depending file:
Will make class partial, adds a new file to the project, sets its dependency to the originating file, adds required usings and the partial class with the selected members.
Sample.cs
    Sample.NewTopic.cs

b) move members to an existing file (suggesting all related files for the current class + other, in which case the user selects the file where to put it):
Will make class partial, adds required usings to the selected file and the partial class with the selected members.

c) move members to an unrelated file (suggesting all related files for the current class + other, in which case the user selects the file where to put it):
Sample.cs
AnotherTopic.cs (unrelated file)


2) existing: one or many files with a partial class
a) move members to a NEW file:
Adds a new file to the project, sets its dependency to the originating file, adds required usings and the partial class with the selected members.
Sample.cs
    Sample.designer.cs
    Sample.Topic1.cs
    Sample.Topic2.cs
    Sample.NewTopic.cs
or
Sample.cs
    Sample.designer.cs
    Sample.Topic1.cs
    Sample.Topic2.cs
AnotherTopic.cs (unrelated file)

Note: The dependency status can be inferred from the file name chosen.

b) move members to an existing file (suggesting all related files for the current class + other, in which case the user selects the file where to put it):
Adds required usings to the selected file and the partial class with the selected members.
Sample.cs
    Sample.designer.cs (removed from here)
    Sample.Topic1.cs (moved to here)
    Sample.Topic2.cs


I guess that should cover it. Might require Roslyn though. For C++ the thing should work similar.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17886 Posts

Posted - May 10 2022 :  1:18:28 PM  Show Profile  Reply with Quote
That seems fairly comprehensive, thank you. I have put in a feature request for all of this:

case=148126

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:
© 2021 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000