Enable breakpoints in embedded editor

2,992 views
Skip to first unread message

Tuna

unread,
May 11, 2012, 6:38:46 PM5/11/12
to Ajax.org Cloud9 Editor (Ace)
I'm (very) confused as to how I enable setting of breakpoints in an
embedded ace editor (with a custom edit mode)?

I can see how you can do session.setBreakpoint(), but how do you allow
users to click the gutter/press a key to set a breakpoint on a line?
The standard editor doesn't seem to do this.

If it helps, I'm creating the editor in javascript with something
like: var editor = ace.edit(sourceId);

Harutyun Amirjanyan

unread,
May 12, 2012, 2:43:08 AM5/12/12
to ace-d...@googlegroups.com
you can use this function
editor.on("guttermousedown", function(e){
var target = e.domEvent.target;
if (target.className.indexOf("ace_gutter-cell") == -1)
return;
if (!editor.isFocused())
return;
if (e.clientX > 25 + target.getBoundingClientRect().left)
return;

var row = e.getDocumentPosition().row
e.editor.session.setBreakpoint(row)
e.stop()
})

and don't forget to add some styling for breakpoints e.g.
.ace_gutter-cell.ace_breakpoint{
border-radius: 20px 0px 0px 20px;
box-shadow: 0px 0px 1px 1px red inset;
}

Tuna

unread,
May 12, 2012, 5:15:12 AM5/12/12
to Ajax.org Cloud9 Editor (Ace)
Absolutely fantastic - just what I needed. I struggled to find the
relevant documentation on the Ace site.

Thank you very much!

Tuna

unread,
May 12, 2012, 8:17:55 AM5/12/12
to Ajax.org Cloud9 Editor (Ace)
Hum. That's interesting. The breakpoints are independent of the lines
of code? So if you put in a newline before a breakpoint, it doesn't
move with the code?

Harutyun Amirjanyan

unread,
May 12, 2012, 9:01:48 AM5/12/12
to ace-d...@googlegroups.com

Tuna

unread,
May 16, 2012, 4:14:38 PM5/16/12
to Ajax.org Cloud9 Editor (Ace)
Thank you, I have it working quite well now: http://fasm.elasticbeanstalk.com/?proj=21rnsl

On May 12, 2:01 pm, Harutyun Amirjanyan <amirjan...@gmail.com> wrote:
> seehttps://github.com/MikeRatcliffe/Acebug/blob/master/chrome/content/ac...

Harutyun Amirjanyan

unread,
May 17, 2012, 3:02:20 AM5/17/12
to ace-d...@googlegroups.com
neat!

Iftekharuddin Mohammed

unread,
Jul 6, 2019, 11:23:36 AM7/6/19
to Ajax.org Cloud9 Editor (Ace)
in the same way, how do we clear the breakpoint?
Reply all
Reply to author
Forward
0 new messages