Question

Ace Editor has Live Syntax Checking, which can check code as it's being typed for syntax errors.

I have a Rails 3.2 site with the Ace file included on each coding page. I added a require statement to the javascript to tell Ace where the worker file is, but it's still not working. How do I get Live Syntax checking to work?

Each coding page includes:

<%= javascript_include_tag "ace-src/ace.js" %>
<%= javascript_include_tag "ace-editor" %>

The Ace files are located in the ace-src folder. I aded this code to ace-editor.js:

require("ace/config").set("workerPath", "/assets/ace-src");
Was it helpful?

Solution

Syntax checking is done via webworker which loads http://www.learneroo.com/assets/ace-src/worker-javascript.js file, but in your site that file seems to be empty. I only see ; in it.
In the jsfiddle i showed earlier http://jsbin.com/ojijeb/432/edit, it didn't work because of cross origin restrictions on web workers (which i didn't notice since was running chrome with --disable-web-security), but thanks to latest Ace update, it works now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top