Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Visual Studio - how to make #region stay on left

Visual Studio - how to make #region stay on left

Scheduled Pinned Locked Moved The Lounge
csharpvisual-studiotutorialquestion
12 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael Breeden
    wrote on last edited by
    #1

    I use the #region "directive" a lot to organize my obviously far too large source files. The trouble is that I want it to stay against the left border of Visual Studio, but the automatic formation moves it out to the code depth. I've looked in the editor settings some, but didn't find it. Anyone know how I might be able to set that? Thanks, Mike

    D R H L 4 Replies Last reply
    0
    • M Michael Breeden

      I use the #region "directive" a lot to organize my obviously far too large source files. The trouble is that I want it to stay against the left border of Visual Studio, but the automatic formation moves it out to the code depth. I've looked in the editor settings some, but didn't find it. Anyone know how I might be able to set that? Thanks, Mike

      D Offline
      D Offline
      DerekT P
      wrote on last edited by
      #2

      Yes. Code in VB.Net :omg: Yes, seriously; in VB.Net the #region "comments" are always aligned to the left-margin, irrespective of code indentation. I can't see a way to replicate that with C# code though. I'm guessing this isn't the answer you were hoping for... ;-) See also Do not indent #region with code – Visual Studio[^]

      L M 2 Replies Last reply
      0
      • M Michael Breeden

        I use the #region "directive" a lot to organize my obviously far too large source files. The trouble is that I want it to stay against the left border of Visual Studio, but the automatic formation moves it out to the code depth. I've looked in the editor settings some, but didn't find it. Anyone know how I might be able to set that? Thanks, Mike

        R Offline
        R Offline
        R Giskard Reventlov
        wrote on last edited by
        #3

        You can't and you shouldn't! :-) I get annoyed because #If does butt to the left! Very annoying.

        Keep your friends close. Keep Kill your enemies closer. The End

        C 1 Reply Last reply
        0
        • D DerekT P

          Yes. Code in VB.Net :omg: Yes, seriously; in VB.Net the #region "comments" are always aligned to the left-margin, irrespective of code indentation. I can't see a way to replicate that with C# code though. I'm guessing this isn't the answer you were hoping for... ;-) See also Do not indent #region with code – Visual Studio[^]

          L Offline
          L Offline
          littleGreenDude
          wrote on last edited by
          #4

          Good feedback, other than the code in VB. :) You would think that it should be a user configurable setting available under Tools > Options > Text Editor > C# > Code Style > Formatting > Indentation But it isn't there. I think we should use the the VS Help > Send Feedback option to bug MS about this.

          1 Reply Last reply
          0
          • M Michael Breeden

            I use the #region "directive" a lot to organize my obviously far too large source files. The trouble is that I want it to stay against the left border of Visual Studio, but the automatic formation moves it out to the code depth. I've looked in the editor settings some, but didn't find it. Anyone know how I might be able to set that? Thanks, Mike

            H Offline
            H Offline
            henrydevid
            wrote on last edited by
            #5

            Visual studio is very helpful, so for that, I have some different thought about it because I have fully experienced with visual studio. So if you used it when you create so many things. So if you want to know it then Apps Development Services just browse the site.

            1 Reply Last reply
            0
            • D DerekT P

              Yes. Code in VB.Net :omg: Yes, seriously; in VB.Net the #region "comments" are always aligned to the left-margin, irrespective of code indentation. I can't see a way to replicate that with C# code though. I'm guessing this isn't the answer you were hoping for... ;-) See also Do not indent #region with code – Visual Studio[^]

              M Offline
              M Offline
              Michael Breeden
              wrote on last edited by
              #6

              Nope. Not the answer. No VB.Net for me. Thanks though.

              1 Reply Last reply
              0
              • R R Giskard Reventlov

                You can't and you shouldn't! :-) I get annoyed because #If does butt to the left! Very annoying.

                Keep your friends close. Keep Kill your enemies closer. The End

                C Offline
                C Offline
                cjb110
                wrote on last edited by
                #7

                re #if, does that not make sense though? Its not supposed to be part of the normal flow, you want it to really stand out.

                R 1 Reply Last reply
                0
                • M Michael Breeden

                  I use the #region "directive" a lot to organize my obviously far too large source files. The trouble is that I want it to stay against the left border of Visual Studio, but the automatic formation moves it out to the code depth. I've looked in the editor settings some, but didn't find it. Anyone know how I might be able to set that? Thanks, Mike

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  As an alternative; use partial classes and put it in multiple, ordered files.

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                  M 1 Reply Last reply
                  0
                  • L Lost User

                    As an alternative; use partial classes and put it in multiple, ordered files.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                    M Offline
                    M Offline
                    Michael Breeden
                    wrote on last edited by
                    #9

                    That just makes debugging a hassle. Also, my methods are often over 1000 lines long... and don't think of critiquing that. I'm hired to write the big complicated stuff.

                    Z L 2 Replies Last reply
                    0
                    • M Michael Breeden

                      That just makes debugging a hassle. Also, my methods are often over 1000 lines long... and don't think of critiquing that. I'm hired to write the big complicated stuff.

                      Z Offline
                      Z Offline
                      ZurdoDev
                      wrote on last edited by
                      #10

                      Michael Breeden wrote:

                      I'm hired to write the big complicated stuff.

                      Good point. The rest of us are working on little kiddy projects. ;)

                      Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

                      1 Reply Last reply
                      0
                      • M Michael Breeden

                        That just makes debugging a hassle. Also, my methods are often over 1000 lines long... and don't think of critiquing that. I'm hired to write the big complicated stuff.

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #11

                        Michael Breeden wrote:

                        That just makes debugging a hassle.

                        No, it doesn't; VS will automatically open the correct file for editing and continue there.

                        Michael Breeden wrote:

                        I'm hired to write the big complicated stuff.

                        AKA "large, unmaintainable mess" :suss:

                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                        1 Reply Last reply
                        0
                        • C cjb110

                          re #if, does that not make sense though? Its not supposed to be part of the normal flow, you want it to really stand out.

                          R Offline
                          R Offline
                          R Giskard Reventlov
                          wrote on last edited by
                          #12

                          No, I don't. I'm OCD - it just looks wrong.

                          Keep your friends close. Keep Kill your enemies closer. The End

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups