Merge git://github.com/ajaxorg/ace

This commit is contained in:
William Candillon 2012-10-18 10:42:58 +02:00
commit 57635c78fa
16 changed files with 86 additions and 24 deletions

View file

@ -136,7 +136,7 @@
</div><div class="description"><p>Returns the value of the distance between the left of the editor and the leftmost part of the visible content.</p>
</div></div></div></div></article><article id="EditSession.getScrollTop" data-title="EditSession.getScrollTop (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getScrollTop" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getScrollTop" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getScrollTop</span></span>(<span class="sigArgList"></span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="returnType " title="Number" data-id="Number">Number</a></li></ul></li></li></ul><ul class="metaInfo"></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getScrollTop" class="ellipsis_description"><p>Returns the value of the distance between the top of the editor and the topmost part of the visible content.</p>
</div><div class="description"><p>Returns the value of the distance between the top of the editor and the topmost part of the visible content.</p>
</div></div></div></div></article><article id="EditSession.getSelection" data-title="EditSession.getSelection (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getSelection" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getSelection" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getSelection</span></span>(<span class="sigArgList"></span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="http://www.nodemanual.org/latest/js_doc/String.html" class="returnType " title="String" data-id="String">String</a></li></ul></li></li></ul><ul class="metaInfo"></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getSelection" class="ellipsis_description"><p>Returns the string of the current selection.</p>
</div></div></div></div></article><article id="EditSession.getSelection" data-title="EditSession.getSelection (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getSelection" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getSelection" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getSelection</span></span>(<span class="sigArgList"></span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="selection.html" class="returnType " title="Selection" data-id="Selection">Selection</a></li></ul></li></li></ul><ul class="metaInfo"></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getSelection" class="ellipsis_description"><p>Returns the string of the current selection.</p>
</div><div class="description"><p>Returns the string of the current selection.</p>
</div></div></div></div></article><article id="EditSession.getState" data-title="EditSession.getState (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getState" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getState" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getState</span></span>(<span class="sigArgList"><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="argument methodClicker" title="Number" data-id="Number">Number</a> row</span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="http://www.nodemanual.org/latest/js_doc/Array.html" class="returnType " title="Array" data-id="Array">Array</a></li></ul></li></li></ul><ul class="metaInfo"><li><span class="label related-to">Related to: <obj class="related_to"> </obj></span></li></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getState" class="ellipsis_description"><p>Returns the state of tokenization at the end of a row.</p>
</div><div class="description"><p>Returns the state of tokenization at the end of a row.</p>
@ -147,9 +147,9 @@
</div><div class="description"><p>Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by <a href="#EditSession.getTabSize" class="link-short" title="EditSession.getTabSize (class method)" data-id="EditSession.getTabSize"><code>getTabSize()</code></a>); otherwise it&#39;s simply <code>&#39;\t&#39;</code>.</p>
</div></div></div></div></article><article id="EditSession.getTextRange" data-title="EditSession.getTextRange (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getTextRange" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getTextRange" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getTextRange</span></span>(<span class="sigArgList"><a href="http://www.nodemanual.org/latest/js_doc/String.html" class="argument methodClicker" title="String" data-id="String">String</a> range</span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="http://www.nodemanual.org/latest/js_doc/Array.html" class="returnType " title="Array" data-id="Array">Array</a></li></ul></li></li></ul><ul class="metaInfo"><li><span class="label related-to">Related to: <obj class="related_to"> </obj></span></li></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getTextRange" class="ellipsis_description"><p>Given a range within the document, this function returns all the text within that range as a single string.</p>
</div><div class="description"><p>Given a range within the document, this function returns all the text within that range as a single string.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">range</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/String.html" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The range to work with</p>
</td></tr></table></div></div></div></div></article><article id="EditSession.getTokenAt" data-title="EditSession.getTokenAt (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getTokenAt" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getTokenAt" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getTokenAt</span></span>(<span class="sigArgList"><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="argument methodClicker" title="Number" data-id="Number">Number</a> row, <a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="argument methodClicker" title="Number" data-id="Number">Number</a> column</span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="http://www.nodemanual.org/latest/js_doc/Array.html" class="returnType " title="Array" data-id="Array">Array</a></li></ul></li></li></ul><ul class="metaInfo"></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getTokenAt" class="ellipsis_description"><p>Returns an array of tokens at the indicated row and column.</p>
</div><div class="description"><p>Returns an array of tokens at the indicated row and column.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">range</td><td class="argType" "><a href="range.html" class="" title="Range" data-id="Range">Range</a></td><td class="argDescription "><p>Required. The range to work with</p>
</td></tr></table></div></div></div></div></article><article id="EditSession.getTokenAt" data-title="EditSession.getTokenAt (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getTokenAt" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getTokenAt" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getTokenAt</span></span>(<span class="sigArgList"><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="argument methodClicker" title="Number" data-id="Number">Number</a> row, <a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="argument methodClicker" title="Number" data-id="Number">Number</a> column</span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="http://www.nodemanual.org/latest/js_doc/Array.html" class="returnType " title="Array" data-id="Array">Array</a></li></ul></li></li></ul><ul class="metaInfo"></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getTokenAt" class="ellipsis_description"><p>Returns an object indicating the token at the current row. The object has two properties: <code>index</code> and <code>start</code>.</p>
</div><div class="description"><p>Returns an object indicating the token at the current row. The object has two properties: <code>index</code> and <code>start</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The row number to retrieve from</p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The column number to retrieve from</p>
</td></tr></table></div></div></div></div></article><article id="EditSession.getTokens" data-title="EditSession.getTokens (class method)" class="article"><div class="section method"><div class="memberContent"><div class="title"><i id="EditSession.getTokens" class="methodToggle methodClicker inactive icon-caret-right"></i><ul class="signatures"><li class="signature"><ul><li class="signature-call"><span id="EditSession.getTokens" class="member-name methodClicker"><span class="sigClassName">EditSession.</span><span class="sigMemberName">getTokens</span></span>(<span class="sigArgList"><a href="http://www.nodemanual.org/latest/js_doc/Number.html" class="argument methodClicker" title="Number" data-id="Number">Number</a> row</span>)<li class="signature-returns"><ul class="argument-types"><li class="argument-type"><a href="http://www.nodemanual.org/latest/js_doc/Array.html" class="returnType " title="Array" data-id="Array">Array</a></li></ul></li></li></ul><ul class="metaInfo"><li><span class="label related-to">Related to: <obj class="related_to"> </obj></span></li></ul></li></ul></div><div class="sideToggler"><div id="ellipsis_EditSession.getTokens" class="ellipsis_description"><p>Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.</p>

View file

@ -3,7 +3,7 @@ include lib
#documentation.span8
-if (isIndex)
!= content
!= indexContent
-else
mixin api()

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -504,6 +504,16 @@ tests for the highlighting.</p>
style="position: relative; left: 3px;top: 23px;width: 97px;" />
<a href="http://kera.io/">Kera.io</a>
</li>
<li>
<img src="doc/site/images/sassmeister-logo.png"
style="position: relative; left: 10px;top: -5px;width: 80px;" />
<a href="http://sassmeister.com/">SassMeister</a>
</li>
<li>
<img src="doc/site/images/spandexio-logo.png"
style="position: relative; left: 10px;top: -5px;width: 80px;" />
<a href="http://SpanDeX.io/">SpanDeX.io</a>
</li>
<li>
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
</li>

View file

@ -242,6 +242,8 @@
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
white-space: pre-line;
word-wrap: break-word;
}
.ace_folding-enabled > .ace_gutter-cell {

View file

@ -318,7 +318,7 @@ var EditSession = function(text, mode) {
};
/**
* EditSession.getSelection() -> String
* EditSession.getSelection() -> Selection
*
* Returns the string of the current selection.
**/
@ -349,11 +349,11 @@ var EditSession = function(text, mode) {
};
/**
* EditSession.getTokenAt(row, column) -> Array
* EditSession.getTokenAt(row, column) -> Object
* - row (Number): The row number to retrieve from
* - column (Number): The column number to retrieve from
*
* Returns an array of tokens at the indicated row and column.
* Returns an object indicating the token at the current row. The object has two properties: `index` and `start`.
**/
this.getTokenAt = function(row, column) {
var tokens = this.bgTokenizer.getTokens(row);
@ -1204,8 +1204,8 @@ var EditSession = function(text, mode) {
};
/** related to: Document.getTextRange
* EditSession.getTextRange(range) -> Array
* - range (String): The range to work with
* EditSession.getTextRange(range) -> String
* - range (Range): The range to work with
*
* {:Document.getTextRange.desc}
**/

View file

@ -33,6 +33,7 @@ define(function(require, exports, module) {
var dom = require("../lib/dom");
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var EventEmitter = require("../lib/event_emitter").EventEmitter;
var Gutter = function(parentEl) {
@ -78,12 +79,15 @@ var Gutter = function(parentEl) {
var annotation = annotations[i];
var row = annotation.row;
var rowInfo = this.$annotations[row];
if (!rowInfo) {
if (!rowInfo)
rowInfo = this.$annotations[row] = {text: []};
}
var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</g, "&lt;");
var annoText = annotation.text;
annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
if (rowInfo.text.indexOf(annoText) === -1)
rowInfo.text.push(annoText);
var type = annotation.type;
if (type == "error")
rowInfo.className = " ace_error";

View file

@ -117,6 +117,10 @@ exports.escapeRegExp = function(str) {
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
};
exports.escapeHTML = function(str) {
return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
};
exports.getMatchOffsets = function(string, regExp) {
var matches = [];

View file

@ -120,11 +120,11 @@ var JadeHighlightRules = function() {
"token": [ "storage.type.function.jade", "entity.name.function.jade"],
"regex": "^(\\s*mixin)( [\\w\\-]+)"
},
/* {
{
"token": "source.js.embedded.jade",
"regex": "^\\s*-|=|!=",
"next": "js_code"
},*/
"regex": "^\\s*(?:-|=|!=)",
"next": "js-start"
},
/*{
"token": "entity.name.tag.script.jade",
"regex": "^\\s*script",
@ -219,7 +219,21 @@ var JadeHighlightRules = function() {
"next": "start"
}
],
"tag_attributes": [
"tag_attributes": [
{
"token" : "string",
"regex" : "'(?=.)",
"next" : "qstring"
},
{
"token" : "string",
"regex" : '"(?=.)',
"next" : "qqstring"
},
{
"token": "entity.other.attribute-name.jade",
"regex": "\\b[a-zA-Z\\-:]+"
},
{
"token": ["entity.other.attribute-name.jade", "punctuation"],
"regex": "\\b([a-zA-Z:\\.-]+)(=)",
@ -284,6 +298,12 @@ var JadeHighlightRules = function() {
}
]
};
this.embedRules(JavaScriptHighlightRules, "js-", [{
token: "text",
regex: ".$",
next: "start"
}]);
/*
this.embedRules(MarkdownHighlightRules, "markdown-", [{
token : "support.function",
@ -324,4 +344,4 @@ var JadeHighlightRules = function() {
oop.inherits(JadeHighlightRules, TextHighlightRules);
exports.JadeHighlightRules = JadeHighlightRules;
});
});

View file

@ -52,7 +52,7 @@ var JavaScriptHighlightRules = function() {
"invalid.deprecated":
"__parent__|__count__|escape|unescape|with|__proto__",
"keyword":
"const|yield|import|get|set" +
"const|yield|import|get|set|" +
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger",
"storage.type":

View file

@ -143,6 +143,8 @@ oop.inherits(JavaScriptWorker, Mirror);
if (maxErrorLevel == "error" && str && /[\w\d{(['"]/.test(str)) {
error.reason = 'Missing ";" before statement';
type = "error";
} else {
type = "info";
}
}
else if (disabledWarningsRe.test(raw)) {

View file

@ -39,6 +39,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Range = require("../range").Range;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var unicode = require("../unicode");
var Mode = function() {
this.$tokenizer = new Tokenizer(new PhpHighlightRules().getRules());
@ -50,6 +51,20 @@ oop.inherits(Mode, TextMode);
(function() {
this.tokenRe = new RegExp("^["
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "\_]+", "g"
);
this.nonTokenRe = new RegExp("^(?:[^"
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "\_]|\s])+", "g"
);
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var outdent = true;
var re = /^(\s*)#/;

View file

@ -30,7 +30,7 @@
define(function(require, exports, module) {
/**
/*
* version of Tokenizer with additional logging
* and infinite loop checks
* can be used for developing/testing new modes

View file

@ -1,8 +1,13 @@
"no use strict";
var console = {
log: function(msgs) {
postMessage({type: "log", data: arguments.join(" ")});
log: function() {
var msgs = Array.prototype.slice.call(arguments, 0);
postMessage({type: "log", data: msgs});
},
error: function() {
var msgs = Array.prototype.slice.call(arguments, 0);
postMessage({type: "log", data: msgs});
}
};
var window = {

View file

@ -84,7 +84,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
var msg = e.data;
switch(msg.type) {
case "log":
window.console && console.log && console.log(msg.data);
window.console && console.log && console.log.apply(console, msg.data);
break;
case "event":