Pure Javascript Intellisense

27 Jun 2008

Last week I sat down to create a proof of concept for a Visual Studio-style intellisense implementation written purely in Javascript. I'm quite pleased with the results, although it's not very robust. Let's cut to the chase - have a look at the pure javascript intellisense demo, or download an archive.

Now, let me explain what's happening there before you get too underwhelmed. Basically, when you type, the script runs a tokenizer to split your previous text into chunks. When that tokenizer hits upon a delimiter, in the demo that's the "." character, it'll send your previous token to the server and popup the result in the intellisense box. You can tab to the box and hit enter to select an option. Pressing tab also cycles through the options in the box.

What I've written is very simple. The tokenizer can be totally swapped out, so you could define your own rules for parsing your input and obtaining a token. And when the token gets to the server, you can interpret it in any way, returning anything back to be put in the intellisense box.

Like I say, this is proof of concept stuff only but I can definitely see applications for it. It's been tested in FF3 and IE8 Beta - nothing else. I've got an SVN repo online and would happily accept patches or comments. Download Javascript Intellisense here.