~robcee/ more than just sandwiches

Posted
5 January 2011 @ 3pm

Tagged
Addons, Code, devtools, Firefox, Mozilla

JavaScript Workspaces

One feature I wanted in Firefox 4 was a JavaScript Workspace. I know I’ve talked about it to a bunch of people. Most of the time, people looked at me like I had a chicken on my head. The concept is so simple yet hard to really convey how useful it is.

Conversations inevitably go something like, “The Console already has a command line, isn’t that good enough?”

“Well, it’s great, but a Workspace lets you write out code as you think of it and it just stays there. You don’t have to go digging through history in case you want to copy and paste it elsewhere.”

more staring as if I had a chicken on my head followed by an incomprehensible, hand-wavey discussion about what you could do with them in Smalltalk…

Anyway, I decided to create a little add-on to better illustrate the idea. It’s pretty rough right now. It has a status bar that doesn’t do anything, and it doesn’t have nice menus to let you save and load files into it. But it has all the keyboard shortcuts you’d expect in an editor (cut/copy/paste) and a context menu that lets you Execute, Inspect or Print selected code against the currently active browser tab’s content. You can open one from the Tools menu (I know, I know, I need to add an entry to the developer menu in the Firefox menu. It’s a prototype!)

Try it out, let me know what you think.

Download: http://antennasoft.net/addons/workspace.xpi

Source: https://github.com/robcee/workspace


11 Comments

Posted by
Philip Chee
5 January 2011 @ 3pm


Posted by
robcee
5 January 2011 @ 3pm

Yep, there are a bunch of them. Most of the “Shells” are more console-like though as opposed to a more persistable scratch pad.

I can see myself keeping one or more workspaces open across the lifetime of my browser and keeping a collection of incantations in them for execution on pages or the browser. Most shells require command-history interaction to get to previous statements.

The goal of the workspace is to be really simple. The code is thing.

(do I have a chicken on my head again?) :)


Posted by
Dave Herman
5 January 2011 @ 4pm

Would it be terribly gauche of me to suggest a screenshot or two? A picture is worth a thousand XPI installs…

Dave


Posted by
robcee
5 January 2011 @ 5pm

not gauche. Unfortunately there’s not much to see as it’s just a window with a textbox. But here you go!

empty Workspace


Posted by
harrutyun amirjanyan
5 January 2011 @ 6pm

maybe there’s a chicken on my head too
but i never could enjoy using those shells, especially after using Mathematica

i have putted together something similar to JavaScript Workspace too (jsmirror in http://code.google.com/p/foximirror/)
with ‘executeSelection’, ‘commentBlock’ and inspect~autocompletion(ctrl+space) which executes current statement, but it’s very messy, and very far from what i want

in Mathematica you can have cells which could be grouped,
evaluated together,closed,…

maybe when ace finally will have code folding it will be possible to make a real notebook with it.


Posted by
Jason Orendorff
5 January 2011 @ 9pm

OMG, we all have chickens on our heads.

Mathcad did it for me. Wrote about it here: http://jorendorff.blogspot.com/search?q=worksheet


Posted by
robcee
6 January 2011 @ 12pm

@jorendorff nice post. I’m glad this chicken-on-head thing hasn’t impeded your lifestyle too much.

It’s been awhile since I looked at Mathematica (never used Mathcad), but it’s a good comparison.

thanks for the comments!


Posted by
rektide
6 January 2011 @ 1pm

The concept has some similarity to Cloud9IDE.


Posted by
Girish Mony
20 February 2011 @ 10pm

Very interesting concept!!!!! Can I expect a complete javascript IDE in future? Or will it remain as such?


Posted by
robcee
20 February 2011 @ 10pm

Very interesting concept!!!!! Can I expect a complete javascript IDE in future? Or will it remain as such?

We’ll see. With tools like Cloud9, it’s becoming conceivable to have a full IDE in the web. Also, the term “IDE” is pretty loaded. I tend to think of Visual Studio or Eclipse and I don’t think we’ll be building anything of that scale into the browser.

I do hope to build some interesting tools over the next little while though and the workspace is just one of them.

thanks for the comment!


Posted by
Girish Mony
21 February 2011 @ 7am

Thats cool!!!It will be helpful, if you add the option to show the code in different colors like the IDE’s like Eclipse do.

Back again, do I have a chicken on my head? lol!!!!