Electric Editing plugin updated

In a recent post, I announced a plugin that would bring a few features from nostalgic Emacs days to the modern world of Visual Studio 2003 and CodeRush. I received some feedback on that first version and now the Updated, Fixed and Obviously Much Better New VersionTM is available.

To start with, here’s the download link again, for the current version: CR_ElectricEditing-current.zip
If you need instructions to get the plugin installed, review my first post on the topic, please.

Now, what can that fantastic plugin do? I’ll show you some screenshots and provide some explanations with them.

Deletion

One part of the functionality is related to deleting stuff. Not only stuff, but quite specific stuff, namely whitespace. Have you ever noticed how cumbersome it is to get back to the point you where working at after accidentally hitting Return? Electric Editing provides the Electric Backspace function (Hungry Backspace is what is was called in Emacs, for good reasons) that deletes all the whitespace left of the caret in one go. The standard options for that look like this:

With the exception of deleting recent electric insertions (which wouldn’t make much sense), the same options are available for the Delete key:

In addition to the pure functionality, a hinting option has been introduced that allows you to anticipate exactly what will be deleted if you use the Backspace or Delete at any time. The hint lines will always reflect the exact options you have set for the above features. You can switch hinting on and off and configure its color:

Here’s a screenshot of the hints in action, with the color set to blazing red to make them clearly visible.

Automatic linefeeds

The remaining functionality is all about automatically adding linefeeds when certain characters are inserted in the code. There are several options for this, which should really be quite self-explanatory. You can have linefeeds inserted before and after opening and closing braces, as well as after the semicolon. By default, the braces don’t get any linefeeds added if the caret is within parentheses at that moment, because it’s assumed that you want to create an inline array initialisation, like here:

  MethodInfo mi = typeof(MyClass).GetMethod("DoSomething");
  mi.Invoke(anObject, new object[] { one, another });

If you want to insert linefeeds before braces, you have the option to do that only if the caret isn’t already on an empty line.

Important: The semicolon also jumps to the end of the line before inserting itself. Because of this, there’s a conflict with CodeRush’s own smart semicolon feature, which you need to switch off to get the Electric Editing semicolon to work correctly. To do this, enter the CodeRush options dialog via the menu entry DevExpress/Options… Then make sure that the Level (the combo box in the lower left corner of the dialog) is set to Advanced or even Expert. Navigate to the page Editor/Auto Complete/Intellassist/Parens & Brackets. On this page, deactivate the two options “Smart semi-colon”, one in each of the settings groups. I hope the following screenshot makes this clearer:

That’s it then. Have fun and don’t forget to give feedback if there’s anything you like, or don’t!

7 Comments on Electric Editing plugin updated

  1. Awesome plugin. I too am a recovering emacs user. Thanks!

    Like

  2. Great plug-in, and great documentation for it. I love the delete hinting. Thanks Oliver!

    Like

  3. I was one of the people that probably should have reported a bug to you, but it appears to have been fixed. BTW, is there any chance you would release/post the source for this plugin? It may help a few budding plugin writers interested in doing something simmilar. Thanks!

    Like

  4. Ah, not right now, I think… who knows, maybe when the whole thing has matured a bit more. Thanks for your continued interest!

    Like

  5. Not bad, but makes putting a semicolon in a for loop construct is very difficult.

    Like

  6. Hey Bobby,It shouldn’t be hard, I believe … haven’t done any work on or with this in a while, but I seem to remember the plugin should find out whether you’re in a situation where the semicolon really needs to be added to the end of the line. Are you saying that’s not working for you? Or did you just think it would be a problem?

    Like

  7. Hi,

    can not find “Parens and Brackets”. Other options area available.

    Like

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s