Ruby syntax highlighting

44 views
Skip to first unread message

szh

unread,
Jan 31, 2011, 12:59:16 PM1/31/11
to ace-in...@googlegroups.com
Fabian Jakobs, can you please look at my ruby syntax highlighting draft? I can't get it to work, so I think I must be doing something wrong. Here's the draft:
You can also see https://github.com/Heigh-Tech/cloud9 to look at what I've been doing to integrate it with the IDE.
Thanks!

Fabian Jakobs

unread,
Feb 1, 2011, 6:04:32 AM2/1/11
to ace-in...@googlegroups.com
Hi Shlomo,

Some thoughts from looking at the code.

- You can remove "DocCommentHighlightRules". I'm pretty sure they
don't apply for ruby
- the buildin variables look suspicious since they start with a "$"
(e.g. "$DEBUG") the "$" is a special character in regexps and needs to
be escaped. e.g. "\\$DEBUG"
- multi line strings work completely different in Ruby compared to
JavaScript. I'd remove them for the beginning
- I don't think ruby has future reserved keywords. You can remove this as well

Especially the second point will prevent your highlighter from working.

Best,
Fabian

> --
> You received this message because you are subscribed to the Google Groups
> "Ace Internals Dev" group.
> To post to this group, send email to ace-in...@googlegroups.com.
> To unsubscribe from this group, send email to
> ace-internal...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ace-internals?hl=en.
>

szh

unread,
Feb 1, 2011, 9:20:34 AM2/1/11
to ace-in...@googlegroups.com
Thanks for the suggestions. I tried that, and it still isn't working. Is there anything I'm doing wrong now?

szh

unread,
Feb 1, 2011, 9:58:39 AM2/1/11
to ace-in...@googlegroups.com
It may have something to do with the ruby.js part. I didn't totally understand what to do there, so I basically copied most of it from JavaScript and Python.

Fabian Jakobs

unread,
Feb 1, 2011, 10:57:44 AM2/1/11
to ace-in...@googlegroups.com
The ruby.js looks ok. What exactly doesn't work and how do you test
it? To simplify the code you can remove the qstring and qqstring
states. Both are not used in Ruby. Also these two lines at the bottom
can go:

this.addRules(docComment.getRules(), "doc-");
this.$rules["doc-start"][0].next = "start";

Best,
Fabian

szh

unread,
Feb 1, 2011, 11:23:52 AM2/1/11
to ace-in...@googlegroups.com
I found this error in Chrome's console which may be a possible hint:

Error:
Failed to load resource: the server responded with a status of 404 (Not Found)
Filename:
:3000/static/support/ace/lib/ace/worker/worker_client.js

I am not really sure what that means.

szh

unread,
Feb 1, 2011, 11:27:02 AM2/1/11
to ace-in...@googlegroups.com
"What exactly doesn't work..."
 The text just doesn't get highlighted. It all stays black.

Fabian Jakobs

unread,
Feb 1, 2011, 11:45:48 AM2/1/11
to ace-in...@googlegroups.com
You can ignore this.

Fabian Jakobs

unread,
Feb 1, 2011, 11:46:54 AM2/1/11
to ace-in...@googlegroups.com
On Tue, Feb 1, 2011 at 5:27 PM, szh <shlomoza...@gmail.com> wrote:
> "What exactly doesn't work..."
>
>  The text just doesn't get highlighted. It all stays black.

Can you check in your test code to github then I can take a look at
it. I don't see any references to ruby in the demo file
<https://github.com/Heigh-Tech/ace/blob/master/demo/startup.js>.

szh

unread,
Feb 1, 2011, 11:53:20 AM2/1/11
to ace-in...@googlegroups.com
Hmm. I didn't realize I had to edit that file :)
I'll do that now and try again.

szh

unread,
Feb 1, 2011, 12:04:03 PM2/1/11
to ace-in...@googlegroups.com
I just finished adding ruby to demo/startup.js. What does that file do?

Fabian Jakobs

unread,
Feb 1, 2011, 1:21:19 PM2/1/11
to ace-in...@googlegroups.com
It is the implementation for the demo app (editor.html). I asume you
use this to test your code.

Fabian

On Tue, Feb 1, 2011 at 6:04 PM, szh <shlomoza...@gmail.com> wrote:
> I just finished adding ruby to demo/startup.js. What does that file do?
>

szh

unread,
Feb 2, 2011, 8:14:58 AM2/2/11
to ace-in...@googlegroups.com
For future reference, this problem has now been fixed. It was because of some bugs in ruby_highlight_rules.js.
Reply all
Reply to author
Forward
0 new messages