free html hit counter
Posted on: Saturday, 18 February 2017 by Rajiv Popat

There was a time when making IDE plugins for Visual Studio was for folks who specialized in art of writing plugins; i.e. folks like DevExpress and Jetbrains. With Visual Studio Code, writing extensions is no longer a mysterious black art. Even regular programmers like you and me can write extensions which solve our little specific problems.

My specific little problem? I hate having to type a semicolon and then hit enter on every line of code that I write. Specially when the IDE is auto-completing my brackets and quotes. For example when I write:

Console.WriteLine("Hello

If I have the C# plugin installed in VS Code, VS code understands my intent and completes the sentence by writing:

Console.WriteLine("Hello[my cursor is here]")

Notice my cursor position in the snippet above? At this point if I need to end the line I hit the right arrow key twice, then type semicolon and then hit enter to continue to the next line.

Technically, in the above example, if my IDE was really smart, I should just be able to type a semicolon where my cursor is, have the IDE understand my intent, move the semicolon to the end of the line and automatically move me to the next line so that I can continue coding.

It's just 4 keystrokes per-line (two right arrows, a semi-colon and an enter), but when you write hundreds of lines of code condensing 4 keystrokes to 1, adds up and goes a long way in making you productive. Actually, it's not so much about reducing the keystrokes as it is about being in the flow and rhythm.

At one point DevExpress CodeRush had this feature; and If I wrote:

Console.WriteLine("Hello;

CodeRush would intelligently complete this as:

Console.WriteLine("Hello");

It was a very fluid experience. I used to love that feature. When I moved to Linux and Visual Studio Code, I lost most plugins like Resharper and Coderush; but then other free Visual Studio Code plugins made up for most of what I loved between Resharper and CodeRush. However, I continued to miss the above feature where the IDE would automatically understand my intent and move my semicolons where they belong.

So, I decided to see how difficult it would be to write an extension which would:

  1. Automatically move the semi-colon to the end of the line even if you type it in between the line (except for special cases like a for-loop or a for-each loop).
  2. Automatically move you to the next line without having to explicitly hit enter.

It took me one day to write the extension. It took me one more day to brand it with a logo and documentation and publish it to Visual Studio Code Marketplace after releasing it on Github. Before I started this extension, I knew nothing about writing Visual Studio Code extensions. Not to mention that the entire development was done on a Linux Laptop. The code was written in type-script and I am not a java-script or typescript guru either.

I think a regular programmer like me being able to write a plugin of this sort, publish it live to a marketplace and have folks download over just a couple of days says more about Visual Studio Code's highly extendable design than it says about my talent. By far one of the more amazing editors / IDE's I've seen in my life.

Because I used an source code of an open source extension on the marketplace to learn how to get started with writing extensions, and I could see an ever growing community of open source extensions on the Visual Studio Code marketplace, I'm also publishing my code on github.

Go ahead and try it out. It has already had a couple of dozen downloads; makes me hugely productive as a programmer when I am inside Visual Studio Code above all keeps me in flow when I write code. I've been fully supporting this plugin and closing bugs as and when I find them or if and when they are reported.

It is called 'Autoend' and is available for free on the visual studio code marketplace.

If you do try it out please drop me your feedback / comments in the comment section of this post and if you find an issue you can always post it on github or you can always drop a line to contact@thousandtyone.com. Happy coding!

Name
E-mail
Home page

Comment (HTML not allowed)  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview