Use Skywriter for the Firebug console ... possible?

23 views
Skip to first unread message

Mike Ratcliffe

unread,
Jan 16, 2011, 1:18:41 PM1/16/11
to Mozilla Skywriter
Hi

We just had a request in the Firebug group to add syntax highlighting
to the Firebug console.
http://code.google.com/p/fbug/issues/detail?id=3924

The obvious solution to me would be Skywriter. I guess these are the
requirements:
- Skywriter needs to work inside a XUL panel
- We need to be able to save the contents by clicking on either an
internal or external save button
- The styles etc. need to be customizeable to fit the Firebug theme
- We need to be able to map <ctrl><enter> to the Firebug run button
- We need to be able to get the contents of the Skywriter window when
the run button is clicked and pass it to our internal methods to be
evaluated

I am no stranger to working with extensions but I see that Skywriter
uses JQuery etc. Obviously this also needs to run offline. Is there
some kind of Skywriter package designed for use by extension
developers?

I guess in a nutshell I am asking you guys if you have any tips?

~
Mike Ratcliffe

David Mulder

unread,
Jan 16, 2011, 5:54:02 PM1/16/11
to skyw...@googlegroups.com
Hi, 
 I might not be specifically able to help, but from experience I can say I have had no trouble using Skywriter (the ACE based one) inside an extension (please note btw that Skywriter 1.0 is entirely different from the previous ones. The new Skywriter doesn't have a documentation yet, however I advise you to use that one.). Aside of that I can say as a fact all the stuff you describe is possible (there are two ways you can approach the shortcut problem, personally I did it outside of Skywriter (as in on the container of Skywriter), but you can also do this neatly from 'inside')), although a part of me is thinking it seems to be a bit of an overkill for the purpose you have (as in I personally would make it something that can be easily turned off and on (not sure what the default should be)).
 David


--
You received this message because you are subscribed to the Google Groups "Mozilla Skywriter" group.
To post to this group, send email to skyw...@googlegroups.com.
To unsubscribe from this group, send email to skywriter+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/skywriter?hl=en.


Irakli Gozalishvili

unread,
Jan 17, 2011, 3:46:13 AM1/17/11
to skyw...@googlegroups.com
Hi Mike,

I'm sure you can get all of it working, for a starting point you may want to look at my jetpack based addon that embeds ace / skywritter.

https://github.com/Gozala/sky-edit

Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
Address: 29 Rue Saint-Georges, 75009 Paris, France


Fabian Jakobs

unread,
Jan 17, 2011, 2:57:05 AM1/17/11
to skyw...@googlegroups.com
> We just had a request in the Firebug group to add syntax highlighting
> to the Firebug console.
> http://code.google.com/p/fbug/issues/detail?id=3924

Cool. This is also something I am missing.

As David said, the current skywriter has changed a lot. Today it is
basically the ACE editor plus Bespin's plugin system and keyboard
handling.

> The obvious solution to me would be Skywriter. I guess these are the
> requirements:
> - Skywriter needs to work inside a XUL panel

This is reported to work. I have just pushed a fix for the last remaining issue.

> - We need to be able to save the contents by clicking on either an
> internal or external save button

This is trivial.

> - The styles etc. need to be customizeable to fit the Firebug theme

You can define your own themes using CSS or import any TextMate theme

> - We need to be able to map <ctrl><enter> to the Firebug run button

No problem either.

> - We need to be able to get the contents of the Skywriter window when
> the run button is clicked and pass it to our internal methods to be
> evaluated

This is the same as the save button.

> I am no stranger to working with extensions but I see that Skywriter
> uses JQuery etc. Obviously this also needs to run offline. Is there
> some kind of Skywriter package designed for use by extension
> developers?

There are no external dependencies anymore. The new Skywriter/ACE is
completely self contained. Kevin's team has made great progress in
packaging ACE. I'm sure they can point you to the right sources.

> I guess in a nutshell I am asking you guys if you have any tips?

This sounds like a very good match. All the features you request are
already there. Just let is know if you need any further help.

Best,
Fabian

Mike Ratcliffe

unread,
Jan 26, 2011, 8:21:33 AM1/26/11
to Ajax.org Cloud9 Editor (Ace)
Well, we had it working fairly well but then I grabbed the latest
version :o/

I have it ostly working again apart from 2 issues:
1. Toggling the gutter no longer collapses the lines to the left ...
resizing the window fixes them but strangely calling window.resize()
doesn't.
2. We were using the following to add the <ctrl><enter> shortcut to
run the code:
Firebug.Ace.rightWindow.addCommand({
name:'execute',
key:'Ctrl-Enter',
exec: function() {
Firebug.CommandLine.enter(Firebug.currentContext);
}
});

Where Firebug.Ace.rightWindow was the XUL
<browser>.contentWindow.wrappedJSObject where we embedded Ace. It
seems that in the latest version addCommand is no longer available
using this method and I can't import it because I am in XUL context
here. I do, however have access to env.editior and env.settings ... is
it possible to add keys throuth these methods? I would prefer not to
use env.editor.container.addEventListener just because it seems
wasteful, especially when you are obviously already monitoring
keypresses.

Mike Ratcliffe

unread,
Jan 26, 2011, 9:27:08 AM1/26/11
to Ajax.org Cloud9 Editor (Ace)
Apparently another developer added the addCommand method to the source
and when I grabbed the latest version it has overwritten it.It would
be good to know if something is in place in Firebug.env.editor
though ... I don't see anything but I know it does not mean it isn't
there.

On Jan 26, 2:21 pm, Mike Ratcliffe <mich...@ratcliffefamily.org>
wrote:

Fabian Jakobs

unread,
Jan 26, 2011, 9:28:51 AM1/26/11
to ace-d...@googlegroups.com
Hi,

> Well, we had it working fairly well but then I grabbed the latest
> version :o/

doh

> I have it ostly working again apart from 2 issues:
> 1. Toggling the gutter no longer collapses the lines to the left ...
> resizing the window fixes them but strangely calling window.resize()
> doesn't.
> 2. We were using the following to add the <ctrl><enter> shortcut to
> run the code:
> Firebug.Ace.rightWindow.addCommand({
>            name:'execute',
>            key:'Ctrl-Enter',
>            exec: function() {
>                            Firebug.CommandLine.enter(Firebug.currentContext);
>                    }
>        });

This is now two fold:

1. define the command e.g.

var canon = require("pilot/canon");
canon.addCommand({
name: "selectall",
exec: function(env, args, request) {
env.editor.getSelection().selectAll(); }
});

2. add the keybinding. This is currently more complicated than
necessary. You have to extend an existing key binding and configure
the editor with it:

var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
var ue = require("pilot/useragent");

if (ue.isMac)
var bindings = require("ace/keyboard/keybinding/default_mac").bindings;
else
var bindings = require("ace/keyboard/keybinding/default_mac").bindings;

bindings["execute"] = "Ctrl-Enter";
editor.setKeyboardHandler(new HashHandler(bindings));

> --
> You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
> To post to this group, send email to ace-d...@googlegroups.com.
> To unsubscribe from this group, send email to ace-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ace-discuss?hl=en.
>
>

Fabian Jakobs

unread,
Jan 26, 2011, 9:31:18 AM1/26/11
to ace-d...@googlegroups.com
On Wed, Jan 26, 2011 at 2:21 PM, Mike Ratcliffe
<mic...@ratcliffefamily.org> wrote:
> Well, we had it working fairly well but then I grabbed the latest
> version :o/
>
> I have it ostly working again apart from 2 issues:
> 1. Toggling the gutter no longer collapses the lines to the left ...
> resizing the window fixes them but strangely calling window.resize()
> doesn't.

Forgot to answer this one :)

This looks like a regression to me. Can you open an issue at
https://github.com/ajaxorg/ace/issues for this?

Best,
Fabian

Reply all
Reply to author
Forward
0 new messages