41 Comments

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 :)

Comments

Comment by ibrahim sukru

great job thats exacly what i looking for

ibrahim sukru
Comment by Alan

Hello

Thanks for this...
G'night

Comment by Duncan Smart

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

Comment by Emil

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

Emil
Comment by preet

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.

Comment by ben

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?

Comment by ben

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(?)

Comment by Rory Becker

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 :)

Comment by schue

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

schue
Comment by Rory Becker

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.

Comment by Rory Becker

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

Comment by Rory Becker

Replying here also just in case you didn't get notification of my other responses.

Comment by schue

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

schue
Comment by Marek Benes

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

Marek Benes
Comment by Marek Benes

Duncan - sry :)

Marek Benes
Comment by babak

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

babak
Comment by Mark Kamoski

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

Mark Kamoski
Comment by Duncan Smart

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)

Comment by Marek Benes

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

Marek Benes
Comment by Duncan Smart

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!

Comment by Marek Benes

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

Marek Benes
Comment by Mark Kamoski

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

Mark Kamoski
Comment by Mark Kamoski

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="1440x900", 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

Mark Kamoski
Comment by Marek Benes

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

Marek Benes
Comment by ofer

i'm using 10.1.4 with vs 2010 ultimate and line separator does not show...

help!

ofer
Comment by Marek Benes

Thanks!!!!!!!!!!!!!!!

Marek Benes
Comment by Ofer

hurrah!!!!!

Ofer
Comment by Ofer

btw, I added a condition to avoid drawing a line in case of a one liner property e.g.:
int MyProp { get; set; }

Ofer
Comment by Duncan Smart

Send me the patch and I'll look into including it!

Comment by Ofer

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

Ofer
Comment by Ofer

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; }
//!---------------------------------------------

Ofer
Comment by Samuel Tremblay

Very nice plugin.

I worked in vb.net for about 10 years and now I'm in c#. The lines betwen methods is not essential but it's better to read code when you work 8 hours a day, 5 days a week.

Thank you very much.

Samuel Tremblay