Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
0a7d192b3d
43 changed files with 5074 additions and 889 deletions
|
|
@ -40,9 +40,10 @@ var dom = require("./lib/dom");
|
|||
var snippetManager = require("./snippets").snippetManager;
|
||||
|
||||
var Autocomplete = function() {
|
||||
this.autoInsert = true;
|
||||
this.autoInsert = false;
|
||||
this.autoSelect = true;
|
||||
this.exactMatch = false;
|
||||
this.gatherCompletionsId = 0;
|
||||
this.keyboardHandler = new HashHandler();
|
||||
this.keyboardHandler.bindKeys(this.commands);
|
||||
|
||||
|
|
@ -59,7 +60,6 @@ var Autocomplete = function() {
|
|||
};
|
||||
|
||||
(function() {
|
||||
this.gatherCompletionsId = 0;
|
||||
|
||||
this.$init = function() {
|
||||
this.popup = new AcePopup(document.body || document.documentElement);
|
||||
|
|
@ -84,6 +84,8 @@ var Autocomplete = function() {
|
|||
|
||||
this.popup.setData(this.completions.filtered);
|
||||
|
||||
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
||||
|
||||
var renderer = editor.renderer;
|
||||
this.popup.setRow(this.autoSelect ? 0 : -1);
|
||||
if (!keepPopupPosition) {
|
||||
|
|
@ -115,10 +117,9 @@ var Autocomplete = function() {
|
|||
this.changeTimer.cancel();
|
||||
this.hideDocTooltip();
|
||||
|
||||
if (this.popup && this.popup.isOpen) {
|
||||
this.gatherCompletionsId += 1;
|
||||
this.gatherCompletionsId += 1;
|
||||
if (this.popup && this.popup.isOpen)
|
||||
this.popup.hide();
|
||||
}
|
||||
|
||||
if (this.base)
|
||||
this.base.detach();
|
||||
|
|
@ -261,7 +262,6 @@ var Autocomplete = function() {
|
|||
editor.completer = this;
|
||||
}
|
||||
|
||||
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
||||
editor.on("changeSelection", this.changeListener);
|
||||
editor.on("blur", this.blurListener);
|
||||
editor.on("mousedown", this.mousedownListener);
|
||||
|
|
@ -408,10 +408,10 @@ Autocomplete.startCommand = {
|
|||
exec: function(editor) {
|
||||
if (!editor.completer)
|
||||
editor.completer = new Autocomplete();
|
||||
editor.completer.autoInsert =
|
||||
editor.completer.autoInsert = false;
|
||||
editor.completer.autoSelect = true;
|
||||
editor.completer.showPopup(editor);
|
||||
// needed for firefox on mac
|
||||
// prevent ctrl-space opening context menu on firefox on mac
|
||||
editor.completer.cancelContextMenu();
|
||||
},
|
||||
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
|
||||
|
|
|
|||
|
|
@ -893,17 +893,17 @@ var EditSession = function(text, mode) {
|
|||
config.loadModule(["mode", path], function(m) {
|
||||
if (this.$modeId !== path)
|
||||
return cb && cb();
|
||||
if (this.$modes[path] && !options)
|
||||
return this.$onChangeMode(this.$modes[path]);
|
||||
if (m && m.Mode) {
|
||||
if (this.$modes[path] && !options) {
|
||||
this.$onChangeMode(this.$modes[path]);
|
||||
} else if (m && m.Mode) {
|
||||
m = new m.Mode(options);
|
||||
if (!options) {
|
||||
this.$modes[path] = m;
|
||||
m.$id = path;
|
||||
}
|
||||
this.$onChangeMode(m);
|
||||
cb && cb();
|
||||
}
|
||||
cb && cb();
|
||||
}.bind(this));
|
||||
|
||||
// set mode to text until loading is finished
|
||||
|
|
|
|||
|
|
@ -545,9 +545,12 @@ var Editor = function(renderer, session) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (token.type.indexOf("tag-open") != -1)
|
||||
if (token.type.indexOf("tag-open") != -1) {
|
||||
token = iterator.stepForward();
|
||||
|
||||
if (!token)
|
||||
return;
|
||||
}
|
||||
|
||||
var tag = token.value;
|
||||
var depth = 0;
|
||||
var prevToken = iterator.stepBackward();
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ var loadSnippetFile = function(id) {
|
|||
function getCompletionPrefix(editor) {
|
||||
var pos = editor.getCursorPosition();
|
||||
var line = editor.session.getLine(pos.row);
|
||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||
var prefix;
|
||||
// Try to find custom prefixes on the completers
|
||||
editor.completers.forEach(function(completer) {
|
||||
if (completer.identifierRegexps) {
|
||||
|
|
@ -150,7 +150,7 @@ function getCompletionPrefix(editor) {
|
|||
});
|
||||
}
|
||||
});
|
||||
return prefix;
|
||||
return prefix || util.retrievePrecedingIdentifier(line, pos.column);
|
||||
}
|
||||
|
||||
var doLiveAutocomplete = function(e) {
|
||||
|
|
@ -158,8 +158,6 @@ var doLiveAutocomplete = function(e) {
|
|||
var text = e.args || "";
|
||||
var hasCompleter = editor.completer && editor.completer.activated;
|
||||
|
||||
|
||||
|
||||
// We don't want to autocomplete with no prefix
|
||||
if (e.command.name === "backspace") {
|
||||
if (hasCompleter && !getCompletionPrefix(editor))
|
||||
|
|
@ -174,7 +172,6 @@ var doLiveAutocomplete = function(e) {
|
|||
editor.completer = new Autocomplete();
|
||||
}
|
||||
// Disable autoInsert
|
||||
editor.completer.autoSelect = false;
|
||||
editor.completer.autoInsert = false;
|
||||
editor.completer.showPopup(editor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ Mode.prototype.supportsFile = function(filename) {
|
|||
// todo firstlinematch
|
||||
var supportedModes = {
|
||||
ABAP: ["abap"],
|
||||
ABC: ["abc"],
|
||||
ActionScript:["as"],
|
||||
ADA: ["ada|adb"],
|
||||
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
|
||||
|
|
|
|||
|
|
@ -102,6 +102,11 @@ var TextInput = function(parentNode, host) {
|
|||
function resetSelection(isEmpty) {
|
||||
if (inComposition)
|
||||
return;
|
||||
|
||||
// this prevents infinite recursion on safari 8
|
||||
// see https://github.com/ajaxorg/ace/issues/2114
|
||||
inComposition = true;
|
||||
|
||||
if (inputHandler) {
|
||||
selectionStart = 0;
|
||||
selectionEnd = isEmpty ? 0 : text.value.length - 1;
|
||||
|
|
@ -113,6 +118,8 @@ var TextInput = function(parentNode, host) {
|
|||
try {
|
||||
text.setSelectionRange(selectionStart, selectionEnd);
|
||||
} catch(e){}
|
||||
|
||||
inComposition = false;
|
||||
}
|
||||
|
||||
function resetValue() {
|
||||
|
|
|
|||
|
|
@ -2118,11 +2118,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
|||
newHead = copyCursor(origHead);
|
||||
}
|
||||
if (vim.visualMode) {
|
||||
|
||||
if (!(vim.visualBlock && motion === "moveToEol")) {
|
||||
if (!(vim.visualBlock && newHead.ch === Infinity)) {
|
||||
newHead = clipCursorToContent(cm, newHead, vim.visualBlock);
|
||||
}
|
||||
|
||||
if (newAnchor) {
|
||||
newAnchor = clipCursorToContent(cm, newAnchor, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
[1, +1, -1, 12_345, 0.000_1,
|
||||
_, 3_1, 1_2, 1_.0, 0._1];
|
||||
|
||||
{:id => 34, :key => "value"}
|
||||
{:id => ?", :key => "value", anotherKey: [x, y?]}
|
||||
|
||||
=begin
|
||||
=end
|
||||
|
|
|
|||
2207
lib/ace/mode/_test/tokens_abc.json
Normal file
2207
lib/ace/mode/_test/tokens_abc.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -139,7 +139,7 @@
|
|||
["text"," "],
|
||||
["punctuation.separator.key-value","=>"],
|
||||
["text"," "],
|
||||
["constant.numeric","34"],
|
||||
["string.character","?\""],
|
||||
["text",", "],
|
||||
["constant.other.symbol.ruby",":key"],
|
||||
["text"," "],
|
||||
|
|
@ -148,7 +148,15 @@
|
|||
["string.start","\""],
|
||||
["string","value"],
|
||||
["string.end","\""],
|
||||
["paren.rparen","}"]
|
||||
["text",", "],
|
||||
["identifier","anotherKey"],
|
||||
["text",": "],
|
||||
["paren.lparen","["],
|
||||
["identifier","x"],
|
||||
["text",", "],
|
||||
["identifier","y"],
|
||||
["text","?"],
|
||||
["paren.rparen","]}"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ var AbapHighlightRules = function() {
|
|||
{token : "string", regex : "`", next : "start"},
|
||||
{defaultToken : "string"}
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
||||
oop.inherits(AbapHighlightRules, TextHighlightRules);
|
||||
|
||||
|
|
|
|||
58
lib/ace/mode/abc.js
Normal file
58
lib/ace/mode/abc.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
|
||||
*/
|
||||
|
||||
define(function (require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var ABCHighlightRules = require("./abc_highlight_rules").ABCHighlightRules;
|
||||
// TODO: pick appropriate fold mode
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function () {
|
||||
this.HighlightRules = ABCHighlightRules;
|
||||
this.foldingRules = new FoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function () {
|
||||
// this.lineCommentStart = ""%.*"";
|
||||
// this.blockComment = {start: ""/*"", end: ""*/""};
|
||||
// Extra logic goes here.
|
||||
this.$id = "ace/mode/abc"
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
114
lib/ace/mode/abc_highlight_rules.js
Normal file
114
lib/ace/mode/abc_highlight_rules.js
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/* This file was partially autogenerated from https://github.com/jimhawkridge/SublimeABC
|
||||
|
||||
Modifications
|
||||
|
||||
- more classes to express the abc semantic
|
||||
- added syntax highlighting for Zupfnoter conventions (https://github.com/bwl21/zupfnoter)
|
||||
- separate note pitch and note duration - even if it looks the same
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
|
||||
define(function (require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var ABCHighlightRules = function () {
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
start: [
|
||||
{
|
||||
token: ['zupfnoter.information.comment.line.percentage', 'information.keyword', 'in formation.keyword.embedded'],
|
||||
regex: '(%%%%)(hn\\.[a-z]*)(.*)',
|
||||
comment: 'Instruction Comment'
|
||||
},
|
||||
{
|
||||
token: ['information.comment.line.percentage', 'information.keyword.embedded'],
|
||||
regex: '(%%)(.*)',
|
||||
comment: 'Instruction Comment'
|
||||
},
|
||||
|
||||
{
|
||||
token: 'comment.line.percentage',
|
||||
regex: '%.*',
|
||||
comment: 'Comments'
|
||||
},
|
||||
|
||||
{
|
||||
token: 'barline.keyword.operator',
|
||||
regex: '[\\[:]*[|:][|\\]:]*(?:\\[?[0-9]+)?|\\[[0-9]+',
|
||||
comment: 'Bar lines'
|
||||
},
|
||||
{
|
||||
token: ['information.keyword.embedded', 'information.argument.string.unquoted'],
|
||||
regex: '(\\[[A-Za-z]:)([^\\]]*\\])',
|
||||
comment: 'embedded Header lines'
|
||||
},
|
||||
{
|
||||
token: ['information.keyword', 'information.argument.string.unquoted'],
|
||||
regex: '^([A-Za-z]:)([^%\\\\]*)',
|
||||
comment: 'Header lines'
|
||||
},
|
||||
{
|
||||
token: ['text', 'entity.name.function', 'string.unquoted', 'text'],
|
||||
regex: '(\\[)([A-Z]:)(.*?)(\\])',
|
||||
comment: 'Inline fields'
|
||||
},
|
||||
{
|
||||
token: ['accent.constant.language', 'pitch.constant.numeric', 'duration.constant.numeric'],
|
||||
regex: '([\\^=_]*)([A-Ga-gz][,\']*)([0-9]*/*[><0-9]*)',
|
||||
comment: 'Notes'
|
||||
},
|
||||
{
|
||||
token: 'zupfnoter.jumptarget.string.quoted',
|
||||
regex: '[\\"!]\\^\\:.*?[\\"!]',
|
||||
comment: 'Zupfnoter jumptarget'
|
||||
}, {
|
||||
token: 'zupfnoter.goto.string.quoted',
|
||||
regex: '[\\"!]\\^\\@.*?[\\"!]',
|
||||
comment: 'Zupfnoter goto'
|
||||
},
|
||||
{
|
||||
token: 'zupfnoter.annotation.string.quoted',
|
||||
regex: '[\\"!]\\^\\!.*?[\\"!]',
|
||||
comment: 'Zupfnoter annoation'
|
||||
},
|
||||
{
|
||||
token: 'zupfnoter.annotationref.string.quoted',
|
||||
regex: '[\\"!]\\^\\#.*?[\\"!]',
|
||||
comment: 'Zupfnoter annotation reference'
|
||||
},
|
||||
{
|
||||
token: 'chordname.string.quoted',
|
||||
regex: '[\\"!]\\^.*?[\\"!]',
|
||||
comment: 'abc chord'
|
||||
},
|
||||
{
|
||||
token: 'string.quoted',
|
||||
regex: '[\\"!].*?[\\"!]',
|
||||
comment: 'abc annotation'
|
||||
}
|
||||
|
||||
]
|
||||
};
|
||||
|
||||
// this.embedRules(JsonHighlightRules, "json-")
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
ABCHighlightRules.metaData = {
|
||||
fileTypes: ['abc'],
|
||||
name: 'ABC',
|
||||
scopeName: 'text.abcnotation'
|
||||
};
|
||||
|
||||
|
||||
oop.inherits(ABCHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.ABCHighlightRules = ABCHighlightRules;
|
||||
});
|
||||
|
|
@ -116,11 +116,11 @@ oop.inherits(Mode, TextMode);
|
|||
var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("error", function(e) {
|
||||
session.setAnnotations([e.data]);
|
||||
worker.on("annotate", function(e) {
|
||||
session.setAnnotations(e.data);
|
||||
});
|
||||
|
||||
worker.on("ok", function(e) {
|
||||
worker.on("terminate", function() {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ oop.inherits(Worker, Mirror);
|
|||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
|
||||
var errors = [];
|
||||
try {
|
||||
coffee.parse(value).compile();
|
||||
} catch(e) {
|
||||
var loc = e.location;
|
||||
if (loc) {
|
||||
this.sender.emit("error", {
|
||||
errors.push({
|
||||
row: loc.first_line,
|
||||
column: loc.first_column,
|
||||
endRow: loc.last_line,
|
||||
|
|
@ -64,9 +64,8 @@ oop.inherits(Worker, Mirror);
|
|||
type: "error"
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.sender.emit("ok");
|
||||
this.sender.emit("annotate", errors);
|
||||
};
|
||||
|
||||
}).call(Worker.prototype);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ oop.inherits(Mode, TextMode);
|
|||
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("csslint", function(e) {
|
||||
worker.on("annotate", function(e) {
|
||||
session.setAnnotations(e.data);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@ oop.inherits(Worker, Mirror);
|
|||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
if (!value)
|
||||
return this.sender.emit("csslint", []);
|
||||
return this.sender.emit("annotate", []);
|
||||
var infoRules = this.infoRules;
|
||||
|
||||
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 {
|
||||
row: msg.line - 1,
|
||||
column: msg.col - 1,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ oop.inherits(Mode, TextMode);
|
|||
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("jslint", function(results) {
|
||||
worker.on("annotate", function(results) {
|
||||
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() {
|
||||
var value = this.doc.getValue();
|
||||
value = value.replace(/^#!.*\n/, "\n");
|
||||
if (!value) {
|
||||
this.sender.emit("jslint", []);
|
||||
return;
|
||||
}
|
||||
var errors = [];
|
||||
if (!value)
|
||||
return this.sender.emit("annotate", []);
|
||||
|
||||
var errors = [];
|
||||
// jshint reports many false errors
|
||||
// report them as error only if code is actually invalid
|
||||
var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
|
||||
|
|
@ -179,7 +177,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
|||
}
|
||||
// console.log("lint time: " + (new Date() - start));
|
||||
|
||||
this.sender.emit("jslint", errors);
|
||||
this.sender.emit("annotate", errors);
|
||||
};
|
||||
|
||||
}).call(JavaScriptWorker.prototype);
|
||||
|
|
|
|||
|
|
@ -74,11 +74,11 @@ oop.inherits(Mode, TextMode);
|
|||
var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("error", function(e) {
|
||||
session.setAnnotations([e.data]);
|
||||
worker.on("annotate", function(e) {
|
||||
session.setAnnotations(e.data);
|
||||
});
|
||||
|
||||
worker.on("ok", function() {
|
||||
worker.on("terminate", function() {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -46,21 +46,20 @@ oop.inherits(JsonWorker, Mirror);
|
|||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
|
||||
var errors = [];
|
||||
try {
|
||||
if (value)
|
||||
parse(value);
|
||||
} catch (e) {
|
||||
var pos = this.doc.indexToPosition(e.at-1);
|
||||
this.sender.emit("error", {
|
||||
errors.push({
|
||||
row: pos.row,
|
||||
column: pos.column,
|
||||
text: e.message,
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.sender.emit("ok");
|
||||
this.sender.emit("annotate", errors);
|
||||
};
|
||||
|
||||
}).call(JsonWorker.prototype);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ module.exports = {
|
|||
worker.setValue("{}");
|
||||
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() {
|
||||
|
|
@ -71,11 +71,12 @@ module.exports = {
|
|||
worker.deferredUpdate.call();
|
||||
|
||||
var event = this.sender.events[0];
|
||||
assert.equal(event[0], "error");
|
||||
assert.equal(event[1].type, "error");
|
||||
assert.equal(event[1].text, "Bad string");
|
||||
assert.equal(event[1].row, 1);
|
||||
assert.equal(event[1].column, 0);
|
||||
assert.equal(event[0], "annotate");
|
||||
assert.equal(event[1].length, 1);
|
||||
assert.equal(event[1][0].type, "error");
|
||||
assert.equal(event[1][0].text, "Bad string");
|
||||
assert.equal(event[1][0].row, 1);
|
||||
assert.equal(event[1][0].column, 0);
|
||||
|
||||
},
|
||||
|
||||
|
|
@ -85,11 +86,11 @@ module.exports = {
|
|||
worker.deferredUpdate.call();
|
||||
|
||||
var event = this.sender.events[0];
|
||||
assert.equal(event[0], "error");
|
||||
assert.equal(event[1].type, "error");
|
||||
assert.equal(event[1].text, "Unexpected 'x'");
|
||||
assert.equal(event[1].row, 0);
|
||||
assert.equal(event[1].column, 0);
|
||||
assert.equal(event[0], "annotate");
|
||||
assert.equal(event[1][0].type, "error");
|
||||
assert.equal(event[1][0].text, "Unexpected 'x'");
|
||||
assert.equal(event[1][0].row, 0);
|
||||
assert.equal(event[1][0].column, 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ define(function(require, exports, module){
|
|||
}(require('../mode/text').Mode));
|
||||
keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
|
||||
stringfill = {
|
||||
token: 'string',
|
||||
regex: '.+'
|
||||
defaultToken: 'string'
|
||||
};
|
||||
LiveScriptMode.Rules = {
|
||||
start: [
|
||||
|
|
@ -146,7 +145,7 @@ define(function(require, exports, module){
|
|||
next: 'key'
|
||||
}, {
|
||||
token: 'keyword.operator',
|
||||
regex: '\\S+'
|
||||
regex: '[\\^!|&%+\\-]+'
|
||||
}, {
|
||||
token: 'text',
|
||||
regex: '\\s+'
|
||||
|
|
@ -164,8 +163,7 @@ define(function(require, exports, module){
|
|||
token: 'comment.regex',
|
||||
regex: '\\s+(?:#.*)?'
|
||||
}, {
|
||||
token: 'string.regex',
|
||||
regex: '\\S+'
|
||||
defaultToken: 'string.regex'
|
||||
}
|
||||
],
|
||||
key: [
|
||||
|
|
@ -178,7 +176,7 @@ define(function(require, exports, module){
|
|||
next: 'start'
|
||||
}, {
|
||||
token: 'text',
|
||||
regex: '.',
|
||||
regex: '',
|
||||
next: 'start'
|
||||
}
|
||||
],
|
||||
|
|
@ -188,8 +186,7 @@ define(function(require, exports, module){
|
|||
regex: '.*?\\*/',
|
||||
next: 'start'
|
||||
}, {
|
||||
token: 'comment.doc',
|
||||
regex: '.+'
|
||||
defaultToken: 'comment.doc'
|
||||
}
|
||||
],
|
||||
qdoc: [
|
||||
|
|
|
|||
|
|
@ -148,11 +148,11 @@ oop.inherits(Mode, TextMode);
|
|||
var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("error", function(e) {
|
||||
session.setAnnotations([e.data]);
|
||||
worker.on("annotate", function(e) {
|
||||
session.setAnnotations(e.data);
|
||||
});
|
||||
|
||||
worker.on("ok", function(e) {
|
||||
worker.on("terminate", function() {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -46,24 +46,23 @@ oop.inherits(Worker, Mirror);
|
|||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
|
||||
// var t=Date.now()
|
||||
var errors = [];
|
||||
|
||||
// var t=Date.now()
|
||||
try {
|
||||
luaparse.parse(value);
|
||||
} catch(e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
this.sender.emit("error", {
|
||||
row: e.line - 1,
|
||||
column: e.column,
|
||||
text: e.message,
|
||||
type: "error"
|
||||
});
|
||||
errors.push({
|
||||
row: e.line - 1,
|
||||
column: e.column,
|
||||
text: e.message,
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
// console.log( t-Date.now())
|
||||
return;
|
||||
}
|
||||
// console.log( t-Date.now())
|
||||
this.sender.emit("ok");
|
||||
// console.log( t-Date.now())
|
||||
this.sender.emit("annotate", errors);
|
||||
};
|
||||
|
||||
}).call(Worker.prototype);
|
||||
|
|
|
|||
|
|
@ -143,11 +143,11 @@ oop.inherits(Mode, HtmlMode);
|
|||
if (this.inlinePhp)
|
||||
worker.call("setOptions", [{inline: true}]);
|
||||
|
||||
worker.on("error", function(e) {
|
||||
worker.on("annotate", function(e) {
|
||||
session.setAnnotations(e.data);
|
||||
});
|
||||
|
||||
worker.on("ok", function() {
|
||||
worker.on("terminate", function() {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -69,11 +69,7 @@ oop.inherits(PhpWorker, Mirror);
|
|||
|
||||
// console.log("lint time: " + (new Date() - start));
|
||||
|
||||
if (errors.length) {
|
||||
this.sender.emit("error", errors);
|
||||
} else {
|
||||
this.sender.emit("ok");
|
||||
}
|
||||
this.sender.emit("annotate", errors);
|
||||
};
|
||||
|
||||
}).call(PhpWorker.prototype);
|
||||
|
|
|
|||
|
|
@ -288,6 +288,9 @@ var RubyHighlightRules = function() {
|
|||
return stack[0];
|
||||
return currentState;
|
||||
}
|
||||
}, {
|
||||
token : "string.character",
|
||||
regex : "\\B\\?."
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
||||
|
|
|
|||
7
lib/ace/snippets/abc.js
Normal file
7
lib/ace/snippets/abc.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = require("../requirejs/text!./abc.snippets");
|
||||
exports.scope = "abc";
|
||||
|
||||
});
|
||||
31
lib/ace/snippets/abc.snippets
Normal file
31
lib/ace/snippets/abc.snippets
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
snippet zupfnoter.print
|
||||
%%%%hn.print {"startpos": ${1:pos_y}, "t":"${2:title}", "v":[${3:voices}], "s":[[${4:syncvoices}1,2]], "f":[${5:flowlines}], "sf":[${6:subflowlines}], "j":[${7:jumplines}]}
|
||||
|
||||
snippet zupfnoter.note
|
||||
%%%%hn.note {"pos": [${1:pos_x},${2:pos_y}], "text": "${3:text}", "style": "${4:style}"}
|
||||
|
||||
snippet zupfnoter.annotation
|
||||
%%%%hn.annotation {"id": "${1:id}", "pos": [${2:pos}], "text": "${3:text}"}
|
||||
|
||||
snippet zupfnoter.lyrics
|
||||
%%%%hn.lyrics {"pos": [${1:x_pos},${2:y_pos}]}
|
||||
|
||||
snippet zupfnoter.legend
|
||||
%%%%hn.legend {"pos": [${1:x_pos},${2:y_pos}]}
|
||||
|
||||
|
||||
|
||||
snippet zupfnoter.target
|
||||
"^:${1:target}"
|
||||
|
||||
snippet zupfnoter.goto
|
||||
"^@${1:target}@${2:distance}"
|
||||
|
||||
snippet zupfnoter.annotationref
|
||||
"^#${1:target}"
|
||||
|
||||
snippet zupfnoter.annotation
|
||||
"^!${1:text}@${2:x_offset},${3:y_offset}"
|
||||
|
||||
|
||||
|
|
@ -750,7 +750,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
* @returns {Boolean}
|
||||
**/
|
||||
this.getVScrollBarAlwaysVisible = function() {
|
||||
return this.$hScrollBarAlwaysVisible;
|
||||
return this.$vScrollBarAlwaysVisible;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue