Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ace isn't correctly highlighting R comments #1228

Closed
DeegC opened this issue Jan 30, 2013 · 5 comments
Closed

Ace isn't correctly highlighting R comments #1228

DeegC opened this issue Jan 30, 2013 · 5 comments

Comments

@DeegC
Copy link

DeegC commented Jan 30, 2013

I'm using Ace to edit/display R code and it doesn't appear to be correctly highlighting comments; basically it ignores them. It looks like it's correctly highlighting other R constructs (like NaN) so I assume I've set it up correctly. Do you want me to open a bug somewhere?

The code I'm using to build the HTML is as follows (built using Sinatra):

<td valign="top" style="height: 400px; width: 700px">
    <input type='hidden'
           id='editorvalue'
           name='#{param_name}' />
  <div id="editor" style="height: 400px; width: 700px">#{CGI::escapeHTML(attrib.to_s)}</div>
  <script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
  <script>
      function change() {
          var field = document.getElementById("editorvalue");
          value = editor.getValue();
          field.value = value;
      }

      var editor = ace.edit("editor");
      var session = editor.session;
      session.setTabSize(4);
      session.setUseSoftTabs(true);
      session.setMode("ace/mode/javascript");
      session.on('change', change);
  </script>
</td>
@nightwing
Copy link
Member

to use r mode you need to use r mode, like this

session.setMode("ace/mode/r");// intead of javascript!
because NaN is higlighted in javascript as well

@DeegC
Copy link
Author

DeegC commented Jan 30, 2013

I had tried changing it to use "ace/mode/r" but I got no syntax highlighting at all. I was then assuming that Ace was automatically detecting the mode (which, now that I think about it, is dumb). I debugged this a little further and Chrome debug is telling me that I'm getting "access denied" when I try to hit http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/mode-r.js . Pulling that up in my browser returns:

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>15814FF6D8BFB635</RequestId>
<HostId>
VsbiMKnH/E7Zp7w0lbEaSz8p6G1l5SiZbQWsugrOjgTirrmjrOF+pMx134566U/z
</HostId>
</Error>

Is there something I'm doing that's wrong? Should I be using a different URL? If this isn't the appropriate area for resolving this tell me where to go.

Thanks

@nightwing
Copy link
Member

Ah, i see. Version on cloudfront is old and doesn't have, r mode. you can download https://github.com/ajaxorg/ace-builds/ and use ace.js from there

@DeegC
Copy link
Author

DeegC commented Feb 2, 2013

Thanks for the help. That did it. ----- Original Message -----

From: "Harutyun Amirjanyan" [email protected]
To: "ajaxorg/ace" [email protected]
Cc: "DeegC" [email protected]
Sent: Wednesday, January 30, 2013 4:32:09 PM
Subject: Re: [ace] Ace isn't correctly highlighting R comments (#1228)
Ah, i see. Version on cloudfront is old and doesn't have, r mode. you
can download https://github.com/ajaxorg/ace-builds/ and use ace.js
from there

Reply to this email directly or view it on GitHub .

@nightwing
Copy link
Member

Glad that it worked.
Thanks for the bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants