diff --git a/lib/ace/mode/php.js b/lib/ace/mode/php.js index 18aecb66..e7f2317b 100644 --- a/lib/ace/mode/php.js +++ b/lib/ace/mode/php.js @@ -44,8 +44,8 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode; var unicode = require("../unicode"); var Mode = function(opts) { - var inline = opts && opts.inline; - var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules; + this.inlinePhp = opts && opts.inline; + var HighlightRules = this.inlinePhp ? PhpLangHighlightRules : PhpHighlightRules; this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); @@ -117,6 +117,9 @@ oop.inherits(Mode, TextMode); this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker"); worker.attachToDocument(session.getDocument()); + + if (this.inlinePhp) + worker.call("setOptions", [{inline: true}]); worker.on("error", function(e) { session.setAnnotations(e.data); diff --git a/lib/ace/mode/php_worker.js b/lib/ace/mode/php_worker.js index 59ebcf48..878d88d6 100644 --- a/lib/ace/mode/php_worker.js +++ b/lib/ace/mode/php_worker.js @@ -43,12 +43,17 @@ var PhpWorker = exports.PhpWorker = function(sender) { oop.inherits(PhpWorker, Mirror); (function() { - + this.setOptions = function(opts) { + this.inlinePhp = opts && opts.inline; + }; + this.onUpdate = function() { var value = this.doc.getValue(); var errors = []; // var start = new Date(); + if (this.inlinePhp) + value = ""; var tokens = PHP.Lexer(value, {short_open_tag: 1}); try {