Ace: Allow no semicolons in JavaScript

Created on 9 Jan 2014  ·  5Comments  ·  Source: ajaxorg/ace

I really like code without semicolons. Ace is great, but the error reporting for JavaScript complains about my perfectly fine code without semicolons. Would it be possible to disable warnings about semicolons. All I'm interested in are real syntax errors, without style errors.

Sample code (JavaScript):

alert("Hello, world!")
linters

Most helpful comment

or you can do:

editor.session.$worker.send("changeOptions", [{asi: true}]);

All 5 comments

Agree. Lint tools should be configurable. Since mode options support is added (https://github.com/ajaxorg/ace/commit/10e2c3049cf2fd41a369336c4d03342127a618e2), it will be easy, similar to php inline mode option (https://github.com/ajaxorg/ace/commit/3a864c6056509ceeba2d290407dc91566c223d8e)

By the way, you can currently disable semicolon warnings by placing this comment in your code: /* jshint asi:true */

or you can do:

editor.session.$worker.send("changeOptions", [{asi: true}]);

Any update of this?

Doing this didn't work:

editor.session.$worker.send("changeOptions", [{asi: true}]);

as .$worker was null

Instead, this worked for me (in case someone needs it)

editor.session.on('changeMode', function(e, session) {
    if('ace/mode/javascript' === session.getMode().$id) {
        if(!!session.$worker) {
            session.$worker.send('changeOptions', [{
                asi: true // disable "Missing semicolon." warning in editor for JavaScript
            }])
        }
    }
})
Was this page helpful?
0 / 5 - 0 ratings