I've been a Microsoft Developer for a long time. Given that, I've spent the majority of my time doing development in some sort of integrated development environment or IDE geared towards that; e.g. Borland C++, Visual C++, Visual Basic, Visual Interdev, Visual Studio, Visual Studio with Resharper, and more recently JetBrain IDE's like Rider. In addition to the typical Microsoft languages of C, C++, VB/VB.NET, J++ and C#, I've also spent a good amount of time with Python and Java/J2EE development which saw me using tools like PythonWin and Eclipse based IDE's. More recently I've found myself doing development with the text editor vim for a couple of different reasons. Sometimes I find myself standing up or deploying applications on Linux machines, often headless, and vi/vim is still a defacto editor there. I'm far from a vim guru but I can get around well enough to get most basic editing done. Even if I'm not on a Linux box, vim has become my default for putting together python scripts because I tend to avoid the mouse as it only slows me down. I do jump back into IDE's when I need refactoring tools and features.
That aside I've been using github's CoPilot and it's integration into both vim and various IDE's for more than a year now. I can't have helped but notice different behaviors and levels of support between these editing environments.
-
Copilot Prompts - IDE's have a separate prompt or CoPilot chat window and the responses to prompts are also rendered in that window. There's often a command to copy responses into the active editor or copy response into the clipboard so that responses can be copied manually where you want them. Vim also has prompt capability but it's done in-line in the file one is actively editing as a comment in the language one is working with. Responses are often more in the form of answers with some very small code fragment that one can copy and make use of whereas IDE chat windows tend to provide much larger code blocks as responses. These large code blocks are helpful, but often need a decent amount of editing to properly integrate the response into the code base one is working on.
-
CoPilot Code generation - Now I've already explained that both vim and IDE's with CoPilot integration support prompts and will respond with code/suggestions. Both will also generate code in-line in the active editor, but again I see a behavior difference between the two. Vim tends to generate and better integrate large blocks of code with little or no prompting. Obviously CoPilot doesn't know what you are thinking, but sometimes it gives one that impression, much more so thathan the experience in an IDE. Let me give an example.
I tutor in software development across various topics, but recently I found myself explaining .NET BackgroundWorkers. My example use case was a server side web application which supports file uploads that needed to be processed in some form. The example went from processing in-line as part of the upload resulting in a slow browser response time and therefore poor user experience, then to an in process BackgroundWorker to a separate stand alone BackgroundWorker. The initial implementation started with storing files on the local file system, but I knew would move into using cloud storage in a later tutoring session. Initially the FileProcessor class which inherited BackgroundWorker had some hard-coded file paths and logic to work with the local file system. I don't work with Azure Blob storage frequently so that sort of code doesn't just roll off my fingers. As I started in that direction I began simple, as I usually do, by commenting out that code and then adding code for getting a Azure Blob storage connection string, creating a client, etc. Even before I had the basics working I knew that I was going to refactor this code to apply the Dependency Inversion Principle to extract an interface and a class that implemented that interface to decouple this behavior of retrieving a file from it's implementation and the FileProcessor to adhere to the Single Responsibility Principle. Despite having used Copilot for more than a year now, it was amazing to me when as soon as I went to the top of the C# file and began to declare the interface CoPilot, without any prompts, completed it for me. I then went on to declare a class that implemented this interface with a local file system implementation and once again CoPilot suggestion implemented the entire class and I needed only to hit tab and it was done. I then went on to declare a class for the same interface again, but for an Azure Blob storage implementation and once again, wham, Copilot to the rescue with a full implementation. Next I needed configuration for local file paths, Azure Blob storage connection strings and a container name and again as soon as I began to type classes for this CoPilot seemed to detect my intent and again churned out much of the code with no prompts. I only needed to move these classes to their own files and wire up the configuration and dependencies in the .NET Core IOC container and of course CoPilot helped me there as well.
While I'm sure that Visual Studio or Rider would have helped with all this I describe here, perhaps with some prompts, the code generation while using vim was semless with no prompting. It just seemed to know what I was thinking and where I was going with my class design and churned out the code saving me a lot of typing.
I like the CoPilot chat tools within the IDE's and I do miss the refactoring tools in the IDE's when I'm in vim, but the code generation in vim overall makes me much more productive when my focus is churning out new code. Even after having used this for more than a year I still frequently experience a "wow, this thing is reading my mind". Ideally I'd like the best of both worlds.
This is your prompt Microsoft and JetBrains. Kudo's to whoever did the vim integration.