Friday, May 26, 2017

Visual Studio 2015 -> Common Lisp IDE

TL;DR The setup is pretty easy really, all you need is:
  1. Visual Studio 2015 (may work with any VS 201X)
  2. Lisp Integration Visual Studio Extension
  3. ConEmu already installed and the ConEmuIntegration Visual Studio Extension
  4. A Common Lisp implementation of your choice, set in your %PATH% (via Environment Settings)

Figure 1: Editing a Lisp file in Visual Studio, with an emulated integrated Lisp REPL

INTRODUCTION

So earlier this month, I decided to seriously take a second look at Common Lisp, really learn what makes it so great, and start using it as a first language. However, like most people coming to CL, one of the most asked question is, "What editor [can | should] I use?".

Most people are directed to start with EMACS + SLIME as the defacto, or LispWorks or Allegro and they are all great suggestions. However, what if, for some strange reason...we just don't want to use those combinations? Are we banned forever from utilizing the full power of this all powerful language? We just want to get our feet wet, dabble and see if we want to take the full deep dive, without having to learn yet another tool. We have already invested X years in Y editor/IDE,do I need to spend time learning another tool while learning the language? It may be beneficial in the long run, but for now, is there no other way, and if there is, how can I?

There IS Another Way

Honestly, all you really need is an editor and a REPL!

I started out learning lisp using ED + TMUX. I have been VERY productive with that combo for most of my editing and programming needs for the past year or so, and it initially started out well during my Lisp adventuring. I quickly got used to typing parenthesis by hand and had no issue closing them accurately, so that was a none issue. By quickly, I meant I found myself doing it automatically with my first lisp REPL inputs.

However this post is not about which editor / IDE combo is better or doing it right or wrong, this post is about showing that you can start learning and writing Lisp with ANY tool that you are already comfortable with! It is not about learning a new editor, the time should be spent learning the language. As a matter of fact, I even started using Acme again, and found a good work-flow while editing Lisp, it was a seamless experience. Use what you know to learn the language, then once you are comfortable and/or confident enough, you can start tinkering with the recommended or professional tools, or...stick with what you know.

Anyway, the more I got into Lisp, the more I started thinking of projects I wanted to undertake, from Windows Services to cross platform Desktop Applications. I realised that combining Lisp with C++, seemed like an amazing idea, which would lend itself well to blending Lisp with Qt. Enter my search, for yet another editor that would allow me to do so well. Well, I am currently stuck on Windows, and have started to use Visual Studio again, for minor stuff, however I started searching around, to figure out if anyone ever used VS for Lisp editing/projects? Not many it seemed. I wanted to though. So here are the fruits of my research:

Figure 2: Editor above, ECL REPL below


Is this a good setup? Maybe...I have the editor and REPL in one, which is all any beginner needs for now, contained and supplemented by the power of Visual Studio. This is similar to the Visual Studio F# setup.

Okay, so enough talk, HOW do you get this setup? You need the following:
  1. Visual Studio (Obviously). For my setup, I am using VS 2015 Professional Edition. I believe this can work for VS 2010 and higher, as long as you can install the extensions and they are compatible.
  2. The Lisp Integration Visual Studio Extension.
  3. ConEmu: At the time of this article, I am using the x64 Alpha version which can be downloaded from here.
  4. ConEmuIntegration Visual Studio Extension. Be sure to set your Executable path to point to your ConEmu executable.
  5. A Common Lisp implementation. Does not matter which one. I have two installed, I started with Clozure CL (CCL), however due to my reasons stated above, I am now using Embeddable Common Lisp (ECL). Whichever implementation you are using, set them up in you %PATH%. This is for convenience.
Your setup should look something like Figure 2 above.

I also found that Visual Studio Code has an integrated Terminal, so maybe you can just start there.

Conclusion

I am not saying follow me, I am saying, don't be intimidated or let anything stop you from learning a great language, use what you already know. I wanted to use the best off the bat, be a professional from the start, however if learning the nuances of a strange interface while trying to think in a new language would have been too much, then why not start simple and work my way up. Use Notepad if that floats your boat, just don't be scared off if you don't know Emacs and don't want to. I have nothing against Emacs by the way, I even convinced two of my co-workers to use it, after they saw how much I could do with minimal effort and in a such a short time. It's just that I migrated to Vim 5 years ago and have not gone back. I moved from Vim to Vi to Ed to Acme, however that is not the point of this article, the point is, just start the journey where you are with what you have.

I would also like to thank the authors and the contributors of all the tools mentioned above. Thank You!

No comments:

Post a Comment