Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Move all private fields to top #369

Open
AeroClassics opened this issue Nov 22, 2016 · 7 comments
Open

Feature Request - Move all private fields to top #369

AeroClassics opened this issue Nov 22, 2016 · 7 comments
Labels

Comments

@AeroClassics
Copy link

Can CodeMaid or could CodeMaid gather up all the private variables and move them to the top of the class? Example:

public partial class MyWindow : Window { private string _name; private int _someInt; }

@codecadwallader
Copy link
Owner

Yes, that's our reorganizing feature. Check it out in the docs here: http://www.codemaid.net/documentation/#reorganizing

@AeroClassics
Copy link
Author

Steve,
Thanks for the fast response. If this is true what's the trick? Here is a
sample out of a file I just reorganized:

    /// <summary>
    /// Sets a value indicating whether [in dwell period].
    /// </summary>
    /// <value><c>true</c> if [in dwell period]; otherwise, <c>false

.
public bool InDwellPeriod { set { _inDwellPeriod = value; } }

    /// <summary>
    /// Gets the ROI rectangle stroke.
    /// </summary>
    /// <value>The ROI rectangle stroke.</value>
    public Brush RoiRectangleStroke { get { return 

rectRoiControl.Stroke; } }

    /// <summary>
    /// The current state
    /// </summary>
    private InstrumentState _currentState;

    /// <summary>
    /// Based on the userSensitivity this is the actual sensitivity to 

use when analyzing
///

    private float analyzerSensitivity = 0;
    /// <summary>
    /// The Roi type
    /// </summary>
    private RoiType _roiType;

As you can see there are privates after, or mixed in, with publics. What
option changes this?

Best Regards / Mit freundlichen Grüßen,
Doug

Douglas R. Jones
Sr. Software Engineer/AdVISE Project Mgr.
Rohde & Schwarz USA, Inc.
1500 Lakeside Parkway Ste 100
Flower Mound, TX 75028
Mobile: +1 214-601-3301
Office: +1 469-713-5344
E-Mail: Doug.Jones@rsa.rohde-schwarz.com
Website: http://www.rohde-schwarz.com/

From: Steve Cadwallader notifications@github.com
To: codecadwallader/codemaid codemaid@noreply.github.com
Cc: AeroClassics doug.jones@rsa.rohde-schwarz.com, Author
author@noreply.github.com
Date: 11/22/2016 06:35 PM
Subject: [Newsletter] Re: [codecadwallader/codemaid] Feature
Request - Move all private fields to top (#369)

Yes, that's our reorganizing feature. Check it out in the docs here:
http://www.codemaid.net/documentation/#reorganizing
?
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@codecadwallader
Copy link
Owner

That's not what I would have expected. A couple things to check:

  1. When you run reorganize, are you seeing any changes take place? In the Visual Studio status bar at the bottom, does CodeMaid say that it ran or that it had to stop? If it stopped, can you check the Output tool window to get any error messages that would have been logged?
  2. If reorganize is running, but not putting things in the expected order - can you check your configuration (CodeMaid->Options->Reorganizing) to make sure the Types are in the expected order? The default settings order is that Fields come first.

If neither of those help, if you can include a full code file sample and an export of your settings I may be able to help further.

@ghd796
Copy link

ghd796 commented Aug 19, 2022

Is there a way to stop private fields to the top. I like to keep my full properties together?

@codecadwallader
Copy link
Owner

You can customize how things are reorganized (e.g. group fields and properties together and consider them the same thing for reorganization). There is not a way to "opt out" of certain elements being reorganized. Conceptually this would be a bit difficult as it wouldn't be clear where "opted out" elements would go in the file.

@ghd796
Copy link

ghd796 commented Sep 2, 2022

You can customize how things are reorganized (e.g. group fields and properties together and consider them the same thing for reorganization). There is not a way to "opt out" of certain elements being reorganized. Conceptually this would be a bit difficult as it wouldn't be clear where "opted out" elements would go in the file.

I don't think I'm looking to "opt out" per say. I don't mind the properties being pulled to the top. I just would like the entire 'full property to stay together.
ex.
when you use the [propfull] snippet built into visual studio it groups the related private and public properties together like this

`
private int property1;
public int Property1
{
get { return property1; }
set { property1 = value; }
}

    private int property2;
    public int Property2
    {
        get { return property2; }
        set { property2 = value; }
    }

`

I prefer to keep these property 'sets' together rather than separating out the private and public properties the way codemaid does it.

`
private int property1;

    private int property2;

    public int Property1
    {
        get { return property1; }
        set { property1 = value; }
    }
    public int Property2
    {
        get { return property2; }
        set { property2 = value; }
    }

`

How would I go about getting codemaid to keep the sets together?

@codecadwallader
Copy link
Owner

Ok, thanks for that clarification. There is not currently support for it, but there is an open feature request #570

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants