codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.92k stars 363 forks source link

[Feature] Vertical Alignment (Personally Implemented) #630

Open Dreaming381 opened 5 years ago

Dreaming381 commented 5 years ago

Forgive me if I come off as awkward, I'm not normally involved in open source software projects.

This last week I was looking for a Visual Studio extension that would auto-format my code every time I saved. I have this functionality in my IDE at work using clang formatters in C++ and wanted similar functionality at home working on Unity projects. I came across CodeMaid and really liked its simplicity and flexibility. However, it was missing a feature I missed from work which was vertical alignment, so this weekend I decided to fork the project and add the functionality for myself. Right now it vertically aligns assignments and variable declarations, but I plan to fix any bugs I encounter and add method args and flow control expressions alignment among other things.

There are a few flaws with my implementation:

So my questions:

  1. Is this a feature that people want in CodeMaid?
  2. While I don't plan on spending much time continuing work on this or making it work for others use cases that don't overlap with mine, assuming people do want this feature, are there some small steps I can take to getting this fit for a pull request?
codecadwallader commented 5 years ago

Thanks for reaching out, it sounds like a cool feature. :) To your questions:

  1. It may be, but I didn't find any active issues/feature requests tied to it in a quick search for "vertical".
  2. If you're not planning to continue work on it, how about we leave this open issue with a link back to your fork to see if anybody is interested in picking it up and supporting it?
Dreaming381 commented 5 years ago

Link to Fork

Here's an example of what this does for convenience: Before

        private GameplaySystemGroup m_gameplaySystemGroup;
        private InitializationSystemGroup m_initializationSystemGroup;
        private SimulationSystemGroup m_simulationSystemGroup;
        private PresentationSystemGroup m_presentationSystemGroup;

        public MyWorld(string name, List<Type> systems, bool editorWorld) : base(name)
        {
            var em = EntityManager;
            Singleton = em.CreateEntity();
            em.AddComponentData(Singleton, new SingletonTag());

            m_initializationSystemGroup = GetOrCreateManager<InitializationSystemGroup>();
            m_simulationSystemGroup = GetOrCreateManager<SimulationSystemGroup>();
            m_presentationSystemGroup = GetOrCreateManager<PresentationSystemGroup>();
            m_gameplaySystemGroup = GetOrCreateManager<GameplaySystemGroup>();

After

        private GameplaySystemGroup       m_gameplaySystemGroup;
        private InitializationSystemGroup m_initializationSystemGroup;
        private SimulationSystemGroup     m_simulationSystemGroup;
        private PresentationSystemGroup   m_presentationSystemGroup;

        public MyWorld(string name, List<Type> systems, bool editorWorld) : base(name)
        {
            var em    = EntityManager;
            Singleton = em.CreateEntity();
            em.AddComponentData(Singleton, new SingletonTag());

            m_initializationSystemGroup = GetOrCreateManager<InitializationSystemGroup>();
            m_simulationSystemGroup     = GetOrCreateManager<SimulationSystemGroup>();
            m_presentationSystemGroup   = GetOrCreateManager<PresentationSystemGroup>();
            m_gameplaySystemGroup       = GetOrCreateManager<GameplaySystemGroup>();
StresseJesse commented 4 years ago

I want it! I want it! (In case that's still in question)

govindap11 commented 3 years ago

@StresseJesse I found the workaround to achieve this in a different thread:

Prevent Code Maid from removing blank/whitespace from variable assignments

Dreaming381 commented 3 years ago

@govindap11 I think you misunderstand what this fork did. It wouldn't just disable squashing whitespace, it would actually insert whitespace where there was none before in order to create vertical alignment automatically.

I guess while I am here, I should mention I no longer use this fork. I wanted my formatter to also work as a standalone process and now use a different setup.

govindap11 commented 3 years ago

@Dreaming381 Thank you for your reply. Actually, I recently noticed that difference myself.

I use the following extension for aligning the assignments: Align Assignments