Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Member move to...

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
Uniwares Posted - May 09 2022 : 1:53:45 PM
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.
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - May 10 2022 : 1:18:28 PM
That seems fairly comprehensive, thank you. I have put in a feature request for all of this:

case=148126
Uniwares Posted - May 10 2022 : 08:31:37 AM
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.
feline Posted - May 10 2022 : 06:53:50 AM
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.

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