commit
d62315a740
24 changed files with 2198 additions and 807 deletions
|
|
@ -20,7 +20,7 @@ class Range
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
{:id => 34, :key => "value"}
|
{:id => ?", :key => "value"}
|
||||||
|
|
||||||
|
|
||||||
herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment
|
herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ require("ace/commands/default_commands").commands.push({
|
||||||
// rowCount: rowCount,
|
// rowCount: rowCount,
|
||||||
fixedWidth: true,
|
fixedWidth: true,
|
||||||
el: dom.createElement("div"),
|
el: dom.createElement("div"),
|
||||||
editor: editor
|
editor: inlineEditor
|
||||||
};
|
};
|
||||||
var el = w.el;
|
var el = w.el;
|
||||||
el.appendChild(inlineEditor.container);
|
el.appendChild(inlineEditor.container);
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,10 @@ var dom = require("./lib/dom");
|
||||||
var snippetManager = require("./snippets").snippetManager;
|
var snippetManager = require("./snippets").snippetManager;
|
||||||
|
|
||||||
var Autocomplete = function() {
|
var Autocomplete = function() {
|
||||||
this.autoInsert = true;
|
this.autoInsert = false;
|
||||||
this.autoSelect = true;
|
this.autoSelect = true;
|
||||||
this.exactMatch = false;
|
this.exactMatch = false;
|
||||||
|
this.gatherCompletionsId = 0;
|
||||||
this.keyboardHandler = new HashHandler();
|
this.keyboardHandler = new HashHandler();
|
||||||
this.keyboardHandler.bindKeys(this.commands);
|
this.keyboardHandler.bindKeys(this.commands);
|
||||||
|
|
||||||
|
|
@ -59,7 +60,6 @@ var Autocomplete = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.gatherCompletionsId = 0;
|
|
||||||
|
|
||||||
this.$init = function() {
|
this.$init = function() {
|
||||||
this.popup = new AcePopup(document.body || document.documentElement);
|
this.popup = new AcePopup(document.body || document.documentElement);
|
||||||
|
|
@ -84,6 +84,8 @@ var Autocomplete = function() {
|
||||||
|
|
||||||
this.popup.setData(this.completions.filtered);
|
this.popup.setData(this.completions.filtered);
|
||||||
|
|
||||||
|
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
||||||
|
|
||||||
var renderer = editor.renderer;
|
var renderer = editor.renderer;
|
||||||
this.popup.setRow(this.autoSelect ? 0 : -1);
|
this.popup.setRow(this.autoSelect ? 0 : -1);
|
||||||
if (!keepPopupPosition) {
|
if (!keepPopupPosition) {
|
||||||
|
|
@ -115,10 +117,9 @@ var Autocomplete = function() {
|
||||||
this.changeTimer.cancel();
|
this.changeTimer.cancel();
|
||||||
this.hideDocTooltip();
|
this.hideDocTooltip();
|
||||||
|
|
||||||
if (this.popup && this.popup.isOpen) {
|
|
||||||
this.gatherCompletionsId += 1;
|
this.gatherCompletionsId += 1;
|
||||||
|
if (this.popup && this.popup.isOpen)
|
||||||
this.popup.hide();
|
this.popup.hide();
|
||||||
}
|
|
||||||
|
|
||||||
if (this.base)
|
if (this.base)
|
||||||
this.base.detach();
|
this.base.detach();
|
||||||
|
|
@ -261,7 +262,6 @@ var Autocomplete = function() {
|
||||||
editor.completer = this;
|
editor.completer = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
|
||||||
editor.on("changeSelection", this.changeListener);
|
editor.on("changeSelection", this.changeListener);
|
||||||
editor.on("blur", this.blurListener);
|
editor.on("blur", this.blurListener);
|
||||||
editor.on("mousedown", this.mousedownListener);
|
editor.on("mousedown", this.mousedownListener);
|
||||||
|
|
@ -408,10 +408,10 @@ Autocomplete.startCommand = {
|
||||||
exec: function(editor) {
|
exec: function(editor) {
|
||||||
if (!editor.completer)
|
if (!editor.completer)
|
||||||
editor.completer = new Autocomplete();
|
editor.completer = new Autocomplete();
|
||||||
editor.completer.autoInsert =
|
editor.completer.autoInsert = false;
|
||||||
editor.completer.autoSelect = true;
|
editor.completer.autoSelect = true;
|
||||||
editor.completer.showPopup(editor);
|
editor.completer.showPopup(editor);
|
||||||
// needed for firefox on mac
|
// prevent ctrl-space opening context menu on firefox on mac
|
||||||
editor.completer.cancelContextMenu();
|
editor.completer.cancelContextMenu();
|
||||||
},
|
},
|
||||||
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
|
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
|
||||||
|
|
|
||||||
|
|
@ -545,8 +545,11 @@ var Editor = function(renderer, session) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token.type.indexOf("tag-open") != -1)
|
if (token.type.indexOf("tag-open") != -1) {
|
||||||
token = iterator.stepForward();
|
token = iterator.stepForward();
|
||||||
|
if (!token)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var tag = token.value;
|
var tag = token.value;
|
||||||
var depth = 0;
|
var depth = 0;
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ var loadSnippetFile = function(id) {
|
||||||
function getCompletionPrefix(editor) {
|
function getCompletionPrefix(editor) {
|
||||||
var pos = editor.getCursorPosition();
|
var pos = editor.getCursorPosition();
|
||||||
var line = editor.session.getLine(pos.row);
|
var line = editor.session.getLine(pos.row);
|
||||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
var prefix;
|
||||||
// Try to find custom prefixes on the completers
|
// Try to find custom prefixes on the completers
|
||||||
editor.completers.forEach(function(completer) {
|
editor.completers.forEach(function(completer) {
|
||||||
if (completer.identifierRegexps) {
|
if (completer.identifierRegexps) {
|
||||||
|
|
@ -150,7 +150,7 @@ function getCompletionPrefix(editor) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return prefix;
|
return prefix || util.retrievePrecedingIdentifier(line, pos.column);
|
||||||
}
|
}
|
||||||
|
|
||||||
var doLiveAutocomplete = function(e) {
|
var doLiveAutocomplete = function(e) {
|
||||||
|
|
@ -158,8 +158,6 @@ var doLiveAutocomplete = function(e) {
|
||||||
var text = e.args || "";
|
var text = e.args || "";
|
||||||
var hasCompleter = editor.completer && editor.completer.activated;
|
var hasCompleter = editor.completer && editor.completer.activated;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// We don't want to autocomplete with no prefix
|
// We don't want to autocomplete with no prefix
|
||||||
if (e.command.name === "backspace") {
|
if (e.command.name === "backspace") {
|
||||||
if (hasCompleter && !getCompletionPrefix(editor))
|
if (hasCompleter && !getCompletionPrefix(editor))
|
||||||
|
|
@ -174,7 +172,6 @@ var doLiveAutocomplete = function(e) {
|
||||||
editor.completer = new Autocomplete();
|
editor.completer = new Autocomplete();
|
||||||
}
|
}
|
||||||
// Disable autoInsert
|
// Disable autoInsert
|
||||||
editor.completer.autoSelect = false;
|
|
||||||
editor.completer.autoInsert = false;
|
editor.completer.autoInsert = false;
|
||||||
editor.completer.showPopup(editor);
|
editor.completer.showPopup(editor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
[1, +1, -1, 12_345, 0.000_1,
|
[1, +1, -1, 12_345, 0.000_1,
|
||||||
_, 3_1, 1_2, 1_.0, 0._1];
|
_, 3_1, 1_2, 1_.0, 0._1];
|
||||||
|
|
||||||
{:id => 34, :key => "value"}
|
{:id => ?", :key => "value", anotherKey: [x, y?]}
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
=end
|
=end
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["punctuation.separator.key-value","=>"],
|
["punctuation.separator.key-value","=>"],
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["constant.numeric","34"],
|
["string.character","?\""],
|
||||||
["text",", "],
|
["text",", "],
|
||||||
["constant.other.symbol.ruby",":key"],
|
["constant.other.symbol.ruby",":key"],
|
||||||
["text"," "],
|
["text"," "],
|
||||||
|
|
@ -148,7 +148,15 @@
|
||||||
["string.start","\""],
|
["string.start","\""],
|
||||||
["string","value"],
|
["string","value"],
|
||||||
["string.end","\""],
|
["string.end","\""],
|
||||||
["paren.rparen","}"]
|
["text",", "],
|
||||||
|
["identifier","anotherKey"],
|
||||||
|
["text",": "],
|
||||||
|
["paren.lparen","["],
|
||||||
|
["identifier","x"],
|
||||||
|
["text",", "],
|
||||||
|
["identifier","y"],
|
||||||
|
["text","?"],
|
||||||
|
["paren.rparen","]}"]
|
||||||
],[
|
],[
|
||||||
"start"
|
"start"
|
||||||
],[
|
],[
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,11 @@ oop.inherits(Mode, TextMode);
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
|
var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
worker.on("error", function(e) {
|
worker.on("annotate", function(e) {
|
||||||
session.setAnnotations([e.data]);
|
session.setAnnotations(e.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
worker.on("ok", function(e) {
|
worker.on("terminate", function() {
|
||||||
session.clearAnnotations();
|
session.clearAnnotations();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,13 @@ oop.inherits(Worker, Mirror);
|
||||||
|
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
|
var errors = [];
|
||||||
try {
|
try {
|
||||||
coffee.parse(value).compile();
|
coffee.parse(value).compile();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
var loc = e.location;
|
var loc = e.location;
|
||||||
if (loc) {
|
if (loc) {
|
||||||
this.sender.emit("error", {
|
errors.push({
|
||||||
row: loc.first_line,
|
row: loc.first_line,
|
||||||
column: loc.first_column,
|
column: loc.first_column,
|
||||||
endRow: loc.last_line,
|
endRow: loc.last_line,
|
||||||
|
|
@ -64,9 +64,8 @@ oop.inherits(Worker, Mirror);
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this.sender.emit("ok");
|
this.sender.emit("annotate", errors);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Worker.prototype);
|
}).call(Worker.prototype);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ oop.inherits(Mode, TextMode);
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
worker.on("csslint", function(e) {
|
worker.on("annotate", function(e) {
|
||||||
session.setAnnotations(e.data);
|
session.setAnnotations(e.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,11 @@ oop.inherits(Worker, Mirror);
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
if (!value)
|
if (!value)
|
||||||
return this.sender.emit("csslint", []);
|
return this.sender.emit("annotate", []);
|
||||||
var infoRules = this.infoRules;
|
var infoRules = this.infoRules;
|
||||||
|
|
||||||
var result = CSSLint.verify(value, this.ruleset);
|
var result = CSSLint.verify(value, this.ruleset);
|
||||||
this.sender.emit("csslint", result.messages.map(function(msg) {
|
this.sender.emit("annotate", result.messages.map(function(msg) {
|
||||||
return {
|
return {
|
||||||
row: msg.line - 1,
|
row: msg.line - 1,
|
||||||
column: msg.col - 1,
|
column: msg.col - 1,
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ oop.inherits(Mode, TextMode);
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
worker.on("jslint", function(results) {
|
worker.on("annotate", function(results) {
|
||||||
session.setAnnotations(results.data);
|
session.setAnnotations(results.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -116,12 +116,10 @@ oop.inherits(JavaScriptWorker, Mirror);
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
value = value.replace(/^#!.*\n/, "\n");
|
value = value.replace(/^#!.*\n/, "\n");
|
||||||
if (!value) {
|
if (!value)
|
||||||
this.sender.emit("jslint", []);
|
return this.sender.emit("annotate", []);
|
||||||
return;
|
|
||||||
}
|
|
||||||
var errors = [];
|
|
||||||
|
|
||||||
|
var errors = [];
|
||||||
// jshint reports many false errors
|
// jshint reports many false errors
|
||||||
// report them as error only if code is actually invalid
|
// report them as error only if code is actually invalid
|
||||||
var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
|
var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
|
||||||
|
|
@ -179,7 +177,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
||||||
}
|
}
|
||||||
// console.log("lint time: " + (new Date() - start));
|
// console.log("lint time: " + (new Date() - start));
|
||||||
|
|
||||||
this.sender.emit("jslint", errors);
|
this.sender.emit("annotate", errors);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(JavaScriptWorker.prototype);
|
}).call(JavaScriptWorker.prototype);
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,11 @@ oop.inherits(Mode, TextMode);
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
|
var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
worker.on("error", function(e) {
|
worker.on("annotate", function(e) {
|
||||||
session.setAnnotations([e.data]);
|
session.setAnnotations(e.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
worker.on("ok", function() {
|
worker.on("terminate", function() {
|
||||||
session.clearAnnotations();
|
session.clearAnnotations();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,21 +46,20 @@ oop.inherits(JsonWorker, Mirror);
|
||||||
|
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
|
var errors = [];
|
||||||
try {
|
try {
|
||||||
if (value)
|
if (value)
|
||||||
parse(value);
|
parse(value);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
var pos = this.doc.indexToPosition(e.at-1);
|
var pos = this.doc.indexToPosition(e.at-1);
|
||||||
this.sender.emit("error", {
|
errors.push({
|
||||||
row: pos.row,
|
row: pos.row,
|
||||||
column: pos.column,
|
column: pos.column,
|
||||||
text: e.message,
|
text: e.message,
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this.sender.emit("ok");
|
this.sender.emit("annotate", errors);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(JsonWorker.prototype);
|
}).call(JsonWorker.prototype);
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ module.exports = {
|
||||||
worker.setValue("{}");
|
worker.setValue("{}");
|
||||||
worker.deferredUpdate.call();
|
worker.deferredUpdate.call();
|
||||||
|
|
||||||
assert.equal(this.sender.events[0][0], "ok");
|
assert.equal(this.sender.events[0][1].length, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
"test check for syntax error": function() {
|
"test check for syntax error": function() {
|
||||||
|
|
@ -71,11 +71,12 @@ module.exports = {
|
||||||
worker.deferredUpdate.call();
|
worker.deferredUpdate.call();
|
||||||
|
|
||||||
var event = this.sender.events[0];
|
var event = this.sender.events[0];
|
||||||
assert.equal(event[0], "error");
|
assert.equal(event[0], "annotate");
|
||||||
assert.equal(event[1].type, "error");
|
assert.equal(event[1].length, 1);
|
||||||
assert.equal(event[1].text, "Bad string");
|
assert.equal(event[1][0].type, "error");
|
||||||
assert.equal(event[1].row, 1);
|
assert.equal(event[1][0].text, "Bad string");
|
||||||
assert.equal(event[1].column, 0);
|
assert.equal(event[1][0].row, 1);
|
||||||
|
assert.equal(event[1][0].column, 0);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -85,11 +86,11 @@ module.exports = {
|
||||||
worker.deferredUpdate.call();
|
worker.deferredUpdate.call();
|
||||||
|
|
||||||
var event = this.sender.events[0];
|
var event = this.sender.events[0];
|
||||||
assert.equal(event[0], "error");
|
assert.equal(event[0], "annotate");
|
||||||
assert.equal(event[1].type, "error");
|
assert.equal(event[1][0].type, "error");
|
||||||
assert.equal(event[1].text, "Unexpected 'x'");
|
assert.equal(event[1][0].text, "Unexpected 'x'");
|
||||||
assert.equal(event[1].row, 0);
|
assert.equal(event[1][0].row, 0);
|
||||||
assert.equal(event[1].column, 0);
|
assert.equal(event[1][0].column, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,7 @@ define(function(require, exports, module){
|
||||||
}(require('../mode/text').Mode));
|
}(require('../mode/text').Mode));
|
||||||
keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
|
keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
|
||||||
stringfill = {
|
stringfill = {
|
||||||
token: 'string',
|
defaultToken: 'string'
|
||||||
regex: '.+'
|
|
||||||
};
|
};
|
||||||
LiveScriptMode.Rules = {
|
LiveScriptMode.Rules = {
|
||||||
start: [
|
start: [
|
||||||
|
|
@ -146,7 +145,7 @@ define(function(require, exports, module){
|
||||||
next: 'key'
|
next: 'key'
|
||||||
}, {
|
}, {
|
||||||
token: 'keyword.operator',
|
token: 'keyword.operator',
|
||||||
regex: '\\S+'
|
regex: '[\\^!|&%+\\-]+'
|
||||||
}, {
|
}, {
|
||||||
token: 'text',
|
token: 'text',
|
||||||
regex: '\\s+'
|
regex: '\\s+'
|
||||||
|
|
@ -164,8 +163,7 @@ define(function(require, exports, module){
|
||||||
token: 'comment.regex',
|
token: 'comment.regex',
|
||||||
regex: '\\s+(?:#.*)?'
|
regex: '\\s+(?:#.*)?'
|
||||||
}, {
|
}, {
|
||||||
token: 'string.regex',
|
defaultToken: 'string.regex'
|
||||||
regex: '\\S+'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
key: [
|
key: [
|
||||||
|
|
@ -178,7 +176,7 @@ define(function(require, exports, module){
|
||||||
next: 'start'
|
next: 'start'
|
||||||
}, {
|
}, {
|
||||||
token: 'text',
|
token: 'text',
|
||||||
regex: '.',
|
regex: '',
|
||||||
next: 'start'
|
next: 'start'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -188,8 +186,7 @@ define(function(require, exports, module){
|
||||||
regex: '.*?\\*/',
|
regex: '.*?\\*/',
|
||||||
next: 'start'
|
next: 'start'
|
||||||
}, {
|
}, {
|
||||||
token: 'comment.doc',
|
defaultToken: 'comment.doc'
|
||||||
regex: '.+'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
qdoc: [
|
qdoc: [
|
||||||
|
|
|
||||||
|
|
@ -148,11 +148,11 @@ oop.inherits(Mode, TextMode);
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
|
var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
worker.on("error", function(e) {
|
worker.on("annotate", function(e) {
|
||||||
session.setAnnotations([e.data]);
|
session.setAnnotations(e.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
worker.on("ok", function(e) {
|
worker.on("terminate", function() {
|
||||||
session.clearAnnotations();
|
session.clearAnnotations();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,24 +46,23 @@ oop.inherits(Worker, Mirror);
|
||||||
|
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
|
var errors = [];
|
||||||
|
|
||||||
// var t=Date.now()
|
// var t=Date.now()
|
||||||
try {
|
try {
|
||||||
luaparse.parse(value);
|
luaparse.parse(value);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if (e instanceof SyntaxError) {
|
if (e instanceof SyntaxError) {
|
||||||
this.sender.emit("error", {
|
errors.push({
|
||||||
row: e.line - 1,
|
row: e.line - 1,
|
||||||
column: e.column,
|
column: e.column,
|
||||||
text: e.message,
|
text: e.message,
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// console.log( t-Date.now())
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// console.log( t-Date.now())
|
// console.log( t-Date.now())
|
||||||
this.sender.emit("ok");
|
this.sender.emit("annotate", errors);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Worker.prototype);
|
}).call(Worker.prototype);
|
||||||
|
|
|
||||||
|
|
@ -143,11 +143,11 @@ oop.inherits(Mode, HtmlMode);
|
||||||
if (this.inlinePhp)
|
if (this.inlinePhp)
|
||||||
worker.call("setOptions", [{inline: true}]);
|
worker.call("setOptions", [{inline: true}]);
|
||||||
|
|
||||||
worker.on("error", function(e) {
|
worker.on("annotate", function(e) {
|
||||||
session.setAnnotations(e.data);
|
session.setAnnotations(e.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
worker.on("ok", function() {
|
worker.on("terminate", function() {
|
||||||
session.clearAnnotations();
|
session.clearAnnotations();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,7 @@ oop.inherits(PhpWorker, Mirror);
|
||||||
|
|
||||||
// console.log("lint time: " + (new Date() - start));
|
// console.log("lint time: " + (new Date() - start));
|
||||||
|
|
||||||
if (errors.length) {
|
this.sender.emit("annotate", errors);
|
||||||
this.sender.emit("error", errors);
|
|
||||||
} else {
|
|
||||||
this.sender.emit("ok");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(PhpWorker.prototype);
|
}).call(PhpWorker.prototype);
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,9 @@ var RubyHighlightRules = function() {
|
||||||
return stack[0];
|
return stack[0];
|
||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
token : "string.character",
|
||||||
|
regex : "\\B\\?."
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,10 @@ var deps = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
liveScript: {
|
||||||
|
path: "mode/livescript.js",
|
||||||
|
url: "https://raw.githubusercontent.com/gkz/LiveScript/master/lib/mode-ls.js"
|
||||||
|
},
|
||||||
coffee: {
|
coffee: {
|
||||||
fetch: function(){
|
fetch: function(){
|
||||||
var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/";
|
var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue