diff --git a/index.html b/index.html index 9158c7ce..19b5e4f7 100644 --- a/index.html +++ b/index.html @@ -330,11 +330,9 @@ var MyNewFoldMode = require("./folding/mynew").MyNewFoldMode; var Mode = function() { // set everything up - var highlighter = new MyNewHighlightRules(); + this.HighlightRules = MyNewHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new MyNewFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); @@ -343,9 +341,8 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here--we won't be covering all of this - - /* These are all optional pieces of code! + // special logic for indent/outdent. + // By default ace keeps indentation of previous line this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); return indent; @@ -358,14 +355,17 @@ oop.inherits(Mode, TextMode); this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; - + + // create worker for live syntax checking this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker"); worker.attachToDocument(session.getDocument()); - + worker.on("errors", function(e) { + session.setAnnotations(e.data); + }); return worker; }; - */ + }).call(Mode.prototype); exports.Mode = Mode; @@ -499,7 +499,7 @@ var fonts = lang.arrayToMap(
  • Run npm install to install required dependencies.
  • Run node tmlanguage.js <path_to_tmlanguage_file>; for example, node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage
  • -

    Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into kitchen_sink.html and demo.js, as well as write any tests for the highlighting.

    +

    Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into ace/ext/modelist.js, and add a sample file for testing.

    A Note on Accuracy

    Your .tmlanguage file will then be converted to the best of the converter’s ability. It is an understatement to say that the tool is imperfect. Probably, language mode creation will never be able to be fully autogenerated. There's a list of non-determinable items; for example: