Lines between methods in the C# editor (CodeRush/DxCore plugin)

Like most .NET developers,  I used to do VB/VBA coding before C# came along. But, one thing I always missed in in the C# code editor was the lines that the VB editor puts between methods. An an avid user of CodeRush and Refactor! Pro, which itself does code structure painting in Visual Studio, I’ve created a DxCore Plugin that draws lines between methods which (IMHO) improves on the ones in the VB code editor.

Here’s a screen shot of it in action:

Draw Lines Between Methods - in action

And here’s the exciting options page:

Draw Lines Between Methods - settings

Even if you’re a VB.NET person you might like to try it to see if it works any better for you than VB’s built-in lines (although I guess you’d need to turn off the built-in method-separating lines somewhere in Tools Options).

The project is hosted on Rory Becker’s DX Core Community Plugins Google Code project, where you can download the source and binaries.

Let me know how you get on with it in the comments :)


39 Responses to Lines between methods in the C# editor (CodeRush/DxCore plugin)

  1. Rory Becker says:

    With Duncan’s permission, I have uploaded the source code for this plugin to Google Code (http://code.google.com/p/dxcorecommunityplugins/).

  2. ibrahim sukru says:

    great job thats exacly what i looking for

  3. Alan says:

    Hello

    Thanks for this…
    G’night

  4. preet says:

    Hi, I got this from google code but I need a way to switch it off periodically. Should I just remove it from the DX Core plugins dir.

    PS it’s a really great example of whats possible, thanks.

  5. duncansmart says:

    @preet: Good idea, I’ve added an “Enabled” setting now: http://code.google.com/p/dxcorecommunityplugins/source/detail?r=128

  6. Emil says:

    Hi. Does it makes lines also in c++? I am looking for something like this, but I couldn’t find it yet. :(

  7. Duncan Smart says:

    @Emil: yes it does work in C++ too.

  8. Pingback: Trennlinien zwischen Methoden | hilpers

  9. ben says:

    I’m having an issue getting this to work in DXCore/CR 9.1.3 in C# VS 2008. I followed the d/l instructions and put the DLL it in the correct folder. I restarted VS and still have no separators. The plug-in doesn’t show up in the options dialog under Painting either.

    Any idea what would cause this?

  10. ben says:

    Don’t worry, a rebuild of the code from SVN fixed it… looks like it just needed to be recompiled for DXCore 9.1.3(?)

  11. Rory Becker says:

    Hey Duncan, I have a contribution on this project from a 3rd party (Increased configurability apparently) and thought you’d be the best one to give it the once over…. Can you mail me (rorybecker@gmail.com) and I’ll pass you a copy :)

  12. schue says:

    Hi, I would like to use this plugin too with VS2008 Prof SP1 and CodeRush Express 3.2. But actually I cannot get it to work. Symptoms:
    - will be shown within Plugins section
    - will not be shown under Painting
    - and, of course, no lines are drawn

    Thanks for help. Perhaps a new rebuild is needed as for DXCore version 3.1. …

    schue

  13. Rory Becker says:

    The 2 simplest ways to achieve this are:

    1.> Download SourceCode and Rebuild against the 3.2.x dlls
    2.> Upgrade to Coderush Xpress version 9.1.x

    Hmmm seems there is not a version of CodeRush Xpress available outside of the clientcenter. I’ll ping DevExpress about that.

    • Rory Becker says:

      Ok the official line from DevExpress (or at least what they told me) is….

      … “v2009 vol 1 of CodeRush and Refactor Pro is available to our customers. This version is also available as Trial within the DXperience subscription. However, the official version of CodeRush Xpress is still v3.2. We are going to announce v2009 vol 1 a bit later.”

      I take this to mean that you should be able to download the DXPerience Trial and install Coderush Xpress 9.1.x from within that

  14. schue says:

    It works now, thank you very much for your assistance.

  15. babak says:

    thanks, great job
    but it did not work for me in VS2008 Pro and Win7 with CodeRushX .
    I did not have that “Unblock” option either.
    and I cannot find where is this Options dialog that is in your snap shot?

    thanks foe help in advance

  16. Mark Kamoski says:

    Duncan — Please help. I really like this idea of line separators. Unfortunately, with VisualStudio 2008 Standard and CodeRushXpress-10.1.1.exe I cannot get it working. I have to use “Ctrl+Shift+Alt+O” to get the options. That is fine. I can see the “Draw Lines Between” settings and I have everything there turned on. When I view my file, however, there are no line speparators. Is there a way to get this to work? Please advise. Thank you. — Mark Kamoski

    • Duncan Smart says:

      Ah I see – you’re using 10.1. For some reason with 10.1 you now have to go to Editor\Painting\GDI Compatibility options page and make sure Enable EditorPaintLanguageElement event is checked. I’ve yet to work out why this isn’t enabled by default

      (The GDI Compatibility page will only be visible if the Level combo on the lower-left of the Options dialog is set to Expert)

      • Marek Benes says:

        Please help. I’m using 10.1 version with Visual Studio 2010 Professional. EditorPaintLanguageElement event is enabled, but line separator does not show :(

      • Duncan Smart says:

        Marek – yes sorry it doesn’t work under VS2010 for me either, yet. I’m waiting on DevExpress to update their documentation so I can figure out how to fix this. Stay tuned!

      • Mark Kamoski says:

        Duncan —

        After doing as you said, it works now.

        Nice.

        (I always wondered why VB had this and CS did not– it is such a good idea.)

        Thank you.

        – Mark Kamoski

  17. Marek Benes says:

    Thanks Duncan. I hope, that it will be as soon as you can, because this plugin is very useful for me. ;)

  18. Mark Kamoski says:

    All — I had some issues with screen paints, issues on my end, that affected my screen paints on this and other functionality. FYI, I have Card=”NvidiaGeForce9500Gt”, Resolution=”1440×900″, Quality=”Higest32Bit”, Os=”WindowsXpPro”, etc. I had Refresh=”60″ and the screen painting was not keeping up with my scrolling, which sometimes means the horiz-line (and other elements like actual code itself) would get munged a bit and not display fully or at all. Anyway, I set Refresh=”75″, which is the max, and all seems well now. This is just FYI. I usually set Refresh=Max but somehow it was reset, probably when testing site display, etc. Even though I am brand new to CodeRush Xpress, this is a great plugin already. HTH. Thank you. — Mark Kamoski

  19. Marek Benes says:

    Hello Dundas, have you got a new version? I’m very impatient :)

  20. Marek Benes says:

    Hello DUNCAN :), have you got a new version? I’m very, very, very impatient :)

  21. ofer says:

    i’m using 10.1.4 with vs 2010 ultimate and line separator does not show…

    help!

  22. Ofer says:

    add this code:
    if (args.LanguageElement.EndLine ==
    args.LanguageElement.StartLine)
    return;
    just after this line:
    if (!settings.Enabled)
    return;

    to the method EventNexus_DecorateLanguageElement in DrawLinesBetweenMethodsPlugIn.cs

    • Duncan Smart says:

      Cheers

    • Ofer says:

      also added this:
      if (args.LanguageElement is Comment && args.LanguageElement.ToString() == “!”)
      {
      var adornment = new
      DrawLinesBetweenMethodsDocumentAdornment
      (args.LanguageElement.Range);
      args.AddBackgroundAdornment(adornment);
      return;
      }

      this will draw line on every “//!” comment.
      it enables you to draw lines wherever you want.

      sample:

      int MyPrpop1 { get; set; }
      int MyPrpop2 { get; set; }
      int MyPrpop3 { get; set; }
      //!———————————————

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>