Table of Contents

Standard interface between a text editor and an IDE?

You may probably consider this a rant post.

UPD 2023 actually, the rant is now irrelevant. These days, we have LSP (Language Server Protocol), which is exactly what I was talking about back in 2015. Still, I'll leave the rest of the text below unchanged.

Problem definition

Long time ago, I used to edit code right in my IDE. For example, assume I work on some Qt project, so, Qt Creator is the IDE I use. I use it for rather long time, so I learned its text editor shortcuts, learned how it behaves, etc.

And one day, I need to work on some Java project. Okay, so I pick Eclipse, or NetBeans, or something else. And, whatever the case, I find it painful, just because I learned how to work in Qt Creator's text editor, and it is convenient for me. So I dig deeply inside the editor's preferences, trying hard to emulate the behavior I'm familiar with. I even try to come up with some color scheme to mimic that of the IDE I used to work with.

It's hardly possible to emulate the behavior completely. So the next step is probably to try some other IDE, just because I don't like the text editor of the IDE we're trying to use now.

As I said before, I find this process of accommodation to IDE's text editor painful. And actually, it's ridiculous: we switch IDEs just because we don't like its editor! Pfff. The IDE may have perfect tools for refactoring, for code navigation, it may fit extremely well in everything else, but I'm still unhappy, because I'd like my text editor to behave differently, or to look differently.

All of this led me to Vim, several years ago. I wanted single, universal, cross-platform text editor; Vim is one of such beasts.

I'm definitely more happy now than I used to be before I met Vim: I always edit code in the same text editor. That's great, but every time I need to run my project, or debug it, or add/remove files to/from project, or perform some complicated refactor, I switch to an IDE, and do what is needed there. For embedded projects, this is MPLABX; for Java, it's usually Eclipse; for Qt, it's Qt Creator, etc.

Vim is a great text editor, but, still, I have a lot of headaches: I want code auto-completion inside my editor, I want to check syntax without leaving my editor, I want to build and run project from within my editor, I want to navigate to some function's definition, etc. For each of the platforms I work with, I have to invent something new: google some Vim plugins, try to set them up, write something on my own, trying to make Vim to accommodate to some particular IDE. For example, I currently ended up writing rather hackish Vim plugin that parses project files of various IDEs (be it MPLABX, or Qt Creator, etc), fetches list of project's files, various options, and makes Vim more or less aware of the project I'm working on.

I also had to invent plugins that allow me to navigate code and to manage per-project options, since I wasn't satisfied with other solutions I've come across.

A lot of headaches. I've spent enormous amount of time setting things up. And all of these troubles could be probably eliminated by some open standard on text editor ↔ IDE interoperation.

Possible solution

The thing is that IDE should not include text editor. Well, it might include one, just to be more self-contained, but the text editor shouldn't be a major part of an IDE: instead, there should be an interface that both parties (IDEs and text editors) should agree on.

A programmer's text editor has some limited number of must-have features in virtually any field these days. Off the top of my head:

Wouldn't it be great if we can open any editor (Vim, Emacs, Sublime Text, etc), bind it to any particular IDE that we need, be it Qt Creator, Eclipse, or whatever, and immediately get all of the IDE luxuries, like code auto-completion, and so on? Without any hackish plugins that try to mimic IDE behavior?

That sounds great, to me.

And, by the way, this is an important part of the Unix philosophy:

Write programs that do one thing and do it well. Write programs to work together.

There are people who agree with me, and they try to change the world: look at the Eclim project by Eric Van Dewoestine. “Eclim” stands for “Eclipse + Vim”: as you might have guessed, it allows Vim to bind to Eclipse, and get all the power of an IDE inside Vim.

I use it for my Java projects: I can't imagine efficient software development among tons of APIs (that Java has) without rich auto-completion, and Eclim solves this trouble for Vim (and other editors, too: as far as I know, there are ways to make Eclim to work at least with Emacs). In Vim, when I press a dot in in Java source file, Eclim performs a request to the Eclipse that runs in parallel, Eclipse returns all the auto-completion data for the given position in code, and Vim displays convenient pop-up menu.

PlantUML Graph

It works flawlessly, very fast and exciting.

Eclim also supports build error handling, refactoring, and a lot of other IDE-related actions. It's not perfect of course: I even submitted a couple of patches to make it better, and now I use it heavily.

Still, it is a kind of hack. Neither Eclipse nor Vim developers care about Eclim (in general).

I'm really surprised by the fact that this topic receives so little interest. As I already mentioned, what's needed is a standard interface for IDE ↔ text editor interoperation, that all mature IDEs and text editors should agree on. Then, we would use our favourite single editor for whatever we're working on. The transition to some new field will be much more smooth, as we still feel “at home” in our editor.

I think, that would make a lot of programmers happier, and, as a consequence, make our software better.

Discuss on reddit: