IntelliJ for Ajax

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

InteliiJ for AJAX

   KB 20791        Last updated on 2016-03-14  




0.00
(0 votes)

Thoughts on Using IntelliJ IDEA to Develop Ajax Applications

Since 2007 or so, the Zimbra client team has mostly used IntelliJ IDEA to edit and manage client source code. Before that, we tended to use Eclipse. I’m currently on IDEA v13.

Since this is client code, I’m primarily working in JavaScript, though I also need to write HTML, CSS, JSP and occasional Java code. Like any good IDE, IDEA recognizes all those and has some nice highlighting and syntax checking for each language.

IDEA is a large piece of software, so its impressive flexibility and richness comes at a cost in terms of size and complexity. You could spend a week in the preferences alone. Fortunately for me, most of them apply to Java so I don’t need to worry about them. It really does offer a mind-boggling number of options and services. I wouldn’t be surprised if there’s a way to play Tetris inside it. Given its size, it’s a bit of a memory hog. In my environment (MacBook Pro) it currently takes about a gig of memory. A few years ago (while on version 11 I think) I was one of the unfortunate users running into a random indexing loop which would run my machine out of memory and crash IDEA. After hobbling it as much as I could by turning off features and loading much less code, and tweaking some low-level memory allocation settings, I was able to get it to limp along until the problem went away with a subsequent release. That was definitely my low point with IntelliJ.

The intentions, inspections, and other analysis done as you type can get to be a bit much. Fortunately, you can turn off the ones you don’t need in Preferences, once you find them. For the most part, I just want the syntax checking (including brace matching). Fairly recently, the JavaScript plugin has added the ability to recognize the pseudo-OO aspects of the language and can do nice things like take you directly to class definitions, as it does easily in Java. Once you get IDEA tuned to do the things you want, writing code is very efficient.

One area of detailed configurability that I really like is key maps. I'm an old-school Unix guy, and my editor of choice is Emacs. In the preferences for IDEA, I can tell it that I want the editor to emulate Emacs, and it does. Even then, I can customize some shortcuts. That means I can spend almost all my editing time on the keyboard, which is where I want to be.

The panel layout is nice. I can subdivide my editing pane into multiple panes both horizontally and vertically, which is especially useful when combined with a nice big monitor. Typically I have a grid with four editing panes going. You can also add and position various types of “tool windows”, for example one that shows the file system layout. The first of the two that I almost always have open is the “Structure” view, which shows you a configurable view of the current file’s functions and/or properties. I like to limit that to showing a sorted list of functions so I can jump around easily in the code (in addition to Ctrl-click on a method name within the code). One weakness of the structure view is that it doesn’t understand the popular JS class definition style where everything is defined in a single anonymous object. In other words, some frameworks don't work well with the Structure view. The core code for ZCS is very procedural/imperative, so IDEA has no problem figured out how everything is related and the Structure view is very useful. The other panel I find really useful is “Changes”. That one hooks into whatever source control system you’ve configured. We use Perforce, and I have to say the Perforce integration is very nice. I can easily view diffs, annotations, create or edit changelists, and commit changes within IDEA.

You can also have more than one IDEA window/session open at a time. That’s not something I do a lot, but it’s handy if I’m working on changes to more than one branch of code.

Jump to: navigation, search