Ace Editor addMarker throwing erro

ace-editor, javascript

Solution

Looks like you forgot to import Range

var Range = ace.require("ace/range").Range
var editor = ace.edit("editor");
editor.session.addMarker(new Range(1,0,1,200),"ace_active-line","fullLine");

also class name for active line marker have changed.

Generally when asking questions like this it is a good idea to create a jsbin like http://jsbin.com/ojijeb/570/edit, since it helps answering a lot

Problem

So I have literally copied the "get started" code from ACE and then tried to add a marker. I copied the syntax from ACE's website which is the same as recommended here: How can I highlight multiple lines with Ace? All I get is an error in the console saying Undefined is not a function. My goal is to add a marker so I can highlight a line of text. Any ideas why this is not working? ``` var editor = ace.edit("editor"); editor.setTheme("ace/theme/monokai"); editor.getSession().setMode("ace/mode/javascript"); editor.getSession().addMarker(new Range(1,0,1,200),"ace_active_line","background"); ```

Original source

Related problems