Codekana

[Update July 25 – Codekana 1.0 has already been released, so you can go to www.codekana.com for the latest release and all the details]

For the past few months, I’ve been working in a new product: Codekana for Visual Studio. It is a Visual Studio add-in which provides enhanced code visualization for C/C++ and C# code in Visual Studio. It enhances the syntax coloring, not for decorative reasons, but in order to provide actual useful information, such as control flow cues; it can draw graphical outlines of the code’s block structure (allowing several One-True-Brace-Styles); it highlights all matches of the last search; it allows you to zoom in and out with control and the mouse wheel; and several other features. Here is a screenshot of how Visual studio looks with Codekana in action (click for a full-size view):



Some details about what you can see in this screenshot:

  • Blocks are highlighted and outlined according to their function: green for ‘if’ blocks, brown (dark-red) for ‘else’ blocks, red for loops and loop control structures, etc… The goal of this is not artistic, it allows you to grasp the control flow of your code without even having to read: you will see where the code loops, whether there is another way to exit a loop than by looping to the end, you can see what block a condition controls, and more – ‘return’s are also highlighted in orange to show early exits, multi-way conditions (‘switch’ blocks) are colored in blue, etc. Once you get accustomed to the coloring (of course, you can customize it to your own taste), you’ll be able to understand control flow at a glance.
  • Also thanks to the coloring above, when you have several nested blocks and a long list of closing braces, you know which brace closes what construct. If you want to insert some doe right before the end of a loop, you can visually tell where to insert it.
  • The name of the function at the top is highlighted too. This is a very quick way of knowing where in the code you are – especially with C-like languages’ brain-dead declaration syntax, the actual defined name can be lost among complex return types, template arguments, and what not. All definitions have the defined name highlighted: function definitions, class/struct/union/enum definitions, etc…
  • All matches of the last search are highlighted in yellow. When you are searching, you rarely want to find just the first occurrence. Visual feedback is invaluable in getting information with high bandwidth.
  • Mismatched braces and parentheses are conveniently highlighted. Also, thanks to some pretty sophisticated incremental parsing technology, and unlike all other tools out there, Codekana is pretty smart about which brace is the mismatched one. Look at the screenshot above, it’s not obvious that the mismatched brace is the one highlighted, and neither VS’s built-in parse, the compiler, or any other tools gets it right, but Codekana tells you which one is the mismatched one.

Of course, all this smart parsing happens in a background multithreaded processing framework – this way, it won’t slow down your editing even if you have just pasted 1,000 lines of pretty convoluted code.

Codekana has several more features, and I could go on talking about them, but since it’s been over one month in closed but intense beta, it’s very solid, and due out next week, I’ll just you furnish you with a link to the documentation if you want to know more, and with a link to download and install the beta version:

Codekana documentation
Download Codekana 0.9

As you might guess, this technology is also part of what will become kodumi, the text editor I’m working on. But, meanwhile, it is already available inside Visual Studio for your development convenience.

I’m now off to getting the web site ready. And BTW, I’m going to release this at a very affordable price-point ($39), to get as many users as possible on board while I prepare great new features.

17 Responses to “Codekana”

  1. Andrey Butov Says:

    Congratulations J! Very nice!

  2. Bill Mill Says:

    I would suggest that you might want to propagate a user’s existing colors on install, and perhaps pop open the settings dialog the first time VS is opened with the tool installed?

    The install clobbered some of my colors (private, while, and if all changed away from yellow) and made some default choices that were really ugly on my pale blue background.

  3. Bill Mill Says:

    But! I like it and I’m leaving it installed. Much faster than the other one’s I’ve tried.

  4. Bill Mill Says:

    ones not one’s! Dang, I hate when people make that mistake. Need more coffee

  5. J Says:

    Thanks Bill,

    Unfortunately, I think it’s Visual Studio who clobbers existing colors on install. What version are you using? I’d guess it’s VS2005 – I think they must have given the coloring code to an intern or something, it’s buggy as hell (not codekana!). I’m hoping I can find more workarounds to their problems in further releases, in order to get the smoothest behavior.

    Indeed, CK’s default choices are only adapted to almost white or almost white, for other configurations manual adjustment is needed. It’s pretty difficult to come up with good defaults for an arbitrary color schem 🙂

    Thanks for the kind comment, and it will be even faster in future releases,

    Jon

  6. Bill Mill Says:

    VS 2003, actually, and I don’t doubt you that they make it hard to access basic stuff. It’s the MS way.

    Changing the colors in VS is a painful process, much easier with your plugin, and I really like the lines now that I’ve got it configured.

  7. Bill Mill Says:

    Maybe you could give me the option to save a colorscheme so I can apply it to my other computers as well?

  8. J Says:

    I’ll definitely try to improve the color-configuration experience. Saving/loading schemes will be there in 1.x or so, I don’t want to delay the release because of that but it’s on the short-list.

  9. Andy Brice Says:

    Looks interesting. Will definitely being checking this out if I start to use VS2005 more.

  10. Frans Bouma Says:

    One thing I really want is the highlight of the line the cursor is on (slightly different background color). In VS.NET I cant define that, but it’s IMHO essential, as often when you move with cntrl- – between spots you’ve been in the code, it’s hard to see where the cursor is.

  11. J Says:

    Hi Frans – I also want that too, but VS’s marker system is limited in that you can’t have a custom background color and a separate foreground color, to show the rest of Codekana markers. In a future version, though, I’m going to completely bypass VS’s rendering mechanism, and that will allow me to provide such a feature.

  12. Filip Says:

    Frans and J,
    ReSharper 3 provides you with the ability to highligh current line.

    J, have a look at DXCore, you could take advantage of what those guys already built into their framework and just build your plugin from there.

  13. J Says:

    Hi Flip,

    I haven’t tried Resharper 3, but I did investigate whether VS would support it. It turns out VS2005 (not VS.NET 2003) does have a special marker type which allows setting just the background, and which combines well with syntax-coloring foreground color. The problem is that it doesn’t work with Codekana’s other markers (braces and parens colored according to their function, etc…), so if I activated that, Codekana’s specific coloring was lost on the current line – not a nice thing, as I find the context-dependent coloring the biggest win of Codekana. So I decided to leave it like this for 1.0, and look for a better solution in a future version.

    With regards to DXCore, actually, all my technology is nowadays host-independent. I plan to include Codekana’s functionality in kodumi, my always-in-development text editor, so that kind of solution is not strategically sound for my growth plans.

  14. lb Says:

    very nifty work!

    i don’t know if this is possible, but could you make it so that blocks such as If/else, and try/catch can be collapsed/expanded (in the same way that methods/classes/namespaces/regions etc can be collapsed/expanded) ??

    Also, while I’m not one of you vi nutheads (;-))… i certainly appreciate and respect the existence of your subgenus…. i think your viemu work is extraordinary! top stuff!

    cheers
    lb

  15. J Says:

    Thanks for nice idea – noted for one of the next releases. It is certainly possible – ViEmu indeeds allows arbitrary creation of collapse/expand “folds” (with the zf operator), and it works fine. So I’ll be able to add that for Codekana. The only hard part will be keeping the parsing state and the folds in sync, but I’m already doing that for all the coloring information and it’s similar.

    Thanks for your kind comment towards vi. Good to find some understanding, which is rare, hopefully the article has worked somewhat in that respect.

  16. Tom Seddon Says:

    Love it. I’ll be giving this one a good trial. I think I’ll find the brace markers useful, and highlighting the last search result is certainly something I’ve missed from vim + emacs for some time!

  17. J Says:

    Tom, thanks for the kind comment. I released 1.1 today, be sure you’re using that one (you can check the version in Tools|Codekana Settings).

    It’s kind of hooking – I don’t want to look at code without the control flow cues myself any more 🙂

Leave a Reply