README.md

NodeJS Console Object Debug Inspector

Or simply node-codein (longtail for SEO) is supposed to do what Webkit Inspector's Console does. Except this works exclusively with NodeJS.

Screenshot

License

Released under MIT License (included); some components have their own licenses but I kept all the comments in their headers so if you're a really really boring person (lawyer, attorney, prosecutor, whatever) you can check the files under libraries/.

duplicate window (opens all the messages in it; uses $.clone() so some controls might be inherited from the parent window)

Not-so-obvious features:

saves last 50 command in local storage, use arrow keys to navigate through previous commands

typing suggestions and autocomplete

shift+enter for new lines

ctrl+L clears the console

tab key indents

Known limitations

Console log sometimes doesn't pass data (rarely... very... rarely). I planned on using EventSource but didn't stick to it because one end doesn't buffer the response and there's no flush command like in PHP. So what it does instead is it keeps connections in a waiting state and when it gets something, it writes the response, closing those connections. Then clients will automatically reconnect but in that split-second if there is any pre-connected client (as in managed to connect before any others), that client will get the logs and those who connected the millisecond later, won't get anything.

Autocomplete spams your server. Lag is in place and can be tweaked but it'll basically chop-off words when you hit enter.

Autocomplete may not appear after using left / right arrow keys or escape. This is intentional, because those 3 keys are GTFO master keys, but if you want the list of suggestions back, type some gibberish and press backspace.

The whole source code is haywired or almost haywired.

There's no syntax highlighting on the input. It will generate lags.

FAQ

Where are the variables from my own module? / How do I debug my module?
This console normally doesn't see them, as it doesn't see scoped (private) variables. Take it as a javascript security feature. But you can always assign them to an object (like "module") and make that object global. (module.variable = ...; global.MyModule = module)

What's wrong about the regular console?
Its overall buffer size, no syntax coloring, hard to use, no direct input, so forth. If you're familar to webkit's "Inspect Element" console tab, you'll see there are some differences.

Then what's wrong with Eclipse's V8 Debugger?
A debugger is something totally different. Well not really but you still need to set breakpoints, stop executions, scope variables, etc. Plus you have to restart Node to put code in. I can make more excuses if necessary.

Why not just fix node-inspector?
I tried. I first tried to pass back stringified objects and decode them in the local console. The problem was that there was a hardcoded limit of 80 characters beyond which the string turned into "str... (length: 2219)". I'm not sure where this came from but I believe it was built into v8 when it was compiled with Node. I also tried fixing scope:frame:handle problem but it seemed to pass back zeros no matter what.

Can you help me do X / can you add X / can you fix X?
Open an issue here on GitHub, 3rd row, 4th button (or something like that), and let's have a look