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 Version™ 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!

Sorry, this blog does not support comments.

I used various blog hosting services since this blog was established in 2005, but unfortunately they turned out to be unreliable in the long term and comment threads were lost in unavoidable transitions. At this time I don't want to enable third-party services for comments since it has become obvious in recent years that these providers invariably monetize information about their visitors and users.

Please use the links in the page footer to get in touch with me. I'm available for conversations on Keybase, Matrix, Mastodon or Twitter, as well as via email.