This commit is contained in:
commit
55266eeed3
72 changed files with 1275 additions and 425 deletions
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"never use strict";
|
"use strict";
|
||||||
|
|
||||||
require("ace/lib/fixoldbrowsers");
|
require("ace/lib/fixoldbrowsers");
|
||||||
require("ace/config").init();
|
require("ace/config").init();
|
||||||
|
|
@ -265,7 +265,7 @@ split.on("focus", function(editor) {
|
||||||
});
|
});
|
||||||
env.split = split;
|
env.split = split;
|
||||||
window.env = env;
|
window.env = env;
|
||||||
window.editor = window.ace = env.editor;
|
window.ace = env.editor;
|
||||||
env.editor.setAnimatedScroll(true);
|
env.editor.setAnimatedScroll(true);
|
||||||
|
|
||||||
var consoleEl = dom.createElement("div");
|
var consoleEl = dom.createElement("div");
|
||||||
|
|
@ -339,12 +339,6 @@ commands.addCommand({
|
||||||
exec: function() {alert("Fake Save File");}
|
exec: function() {alert("Fake Save File");}
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.addCommand({
|
|
||||||
name: "print",
|
|
||||||
bindKey: {win: "Ctrl-P", mac: "Command-P"},
|
|
||||||
exec: function(editor) {editor.session.setValue("please,\ndo not waste paper\n");}
|
|
||||||
});
|
|
||||||
|
|
||||||
var keybindings = {
|
var keybindings = {
|
||||||
// Null = use "default" keymapping
|
// Null = use "default" keymapping
|
||||||
ace: null,
|
ace: null,
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@
|
||||||
<li><a href='http://rubymonk.com'>RubyMonk</a></li>
|
<li><a href='http://rubymonk.com'>RubyMonk</a></li>
|
||||||
<li><a href='http://rocktronica.github.com/tmpltr/'>tmpltr</a></li>
|
<li><a href='http://rocktronica.github.com/tmpltr/'>tmpltr</a></li>
|
||||||
<li><a href='http://dev.cmsmadesimple.org/projects/aceeditor'>CMS Made Simple</a></li>
|
<li><a href='http://dev.cmsmadesimple.org/projects/aceeditor'>CMS Made Simple</a></li>
|
||||||
|
<li><a href='http://tryjasmine.com/'>Try Jasmine</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4>Syntax Highlighters</h4>
|
<h4>Syntax Highlighters</h4>
|
||||||
<ul class="menu-list">
|
<ul class="menu-list">
|
||||||
|
|
|
||||||
|
|
@ -295,13 +295,13 @@ exports.commands = [{
|
||||||
readOnly: true
|
readOnly: true
|
||||||
}, {
|
}, {
|
||||||
name: "jumptomatching",
|
name: "jumptomatching",
|
||||||
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
|
bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"),
|
||||||
exec: function(editor) { editor.jumpToMatching(); },
|
exec: function(editor) { editor.jumpToMatching(); },
|
||||||
multiSelectAction: "forEach",
|
multiSelectAction: "forEach",
|
||||||
readOnly: true
|
readOnly: true
|
||||||
}, {
|
}, {
|
||||||
name: "selecttomatching",
|
name: "selecttomatching",
|
||||||
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
|
bindKey: bindKey("Ctrl-Shift-P", null),
|
||||||
exec: function(editor) { editor.jumpToMatching(true); },
|
exec: function(editor) { editor.jumpToMatching(true); },
|
||||||
readOnly: true
|
readOnly: true
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ var options = {
|
||||||
workerPath: "",
|
workerPath: "",
|
||||||
modePath: "",
|
modePath: "",
|
||||||
themePath: "",
|
themePath: "",
|
||||||
suffix: ".js"
|
suffix: ".js",
|
||||||
|
$moduleUrls: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.get = function(key) {
|
exports.get = function(key) {
|
||||||
|
|
@ -71,6 +72,23 @@ exports.all = function() {
|
||||||
return lang.copyObject(options);
|
return lang.copyObject(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.moduleUrl = function(name, component) {
|
||||||
|
if (options.$moduleUrls[name])
|
||||||
|
return options.$moduleUrls[name];
|
||||||
|
|
||||||
|
var parts = name.split("/");
|
||||||
|
component = component || parts[parts.length - 2] || "";
|
||||||
|
var base = parts[parts.length - 1].replace(component, "").replace(/(^[\-_])|([\-_]$)/, "");
|
||||||
|
|
||||||
|
if (!base && parts.length > 1)
|
||||||
|
base = parts[parts.length - 2];
|
||||||
|
return this.get(component + "Path") + "/" + component + "-" + base + this.get("suffix");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.setModuleUrl = function(name, subst) {
|
||||||
|
return options.$moduleUrls[name] = subst;
|
||||||
|
};
|
||||||
|
|
||||||
exports.init = function() {
|
exports.init = function() {
|
||||||
options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
|
options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
|
||||||
|
|
||||||
|
|
@ -97,10 +115,9 @@ exports.init = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var m = src.match(/^(?:(.*\/)ace\.js)(?:\?|$)/);
|
var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
|
||||||
if (m) {
|
if (m)
|
||||||
scriptUrl = m[1] || m[2];
|
scriptUrl = m[1];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scriptUrl) {
|
if (scriptUrl) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
.ace_scroller {
|
.ace_scroller {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width : 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_content {
|
.ace_content {
|
||||||
|
|
|
||||||
|
|
@ -835,7 +835,7 @@ var EditSession = function(text, mode) {
|
||||||
if (!this.$mode)
|
if (!this.$mode)
|
||||||
this.$setModePlaceholder();
|
this.$setModePlaceholder();
|
||||||
|
|
||||||
fetch(function() {
|
fetch(mode, function() {
|
||||||
require([mode], done);
|
require([mode], done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -852,13 +852,11 @@ var EditSession = function(text, mode) {
|
||||||
callback(_self.$modes[mode]);
|
callback(_self.$modes[mode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetch(callback) {
|
function fetch(name, callback) {
|
||||||
if (!config.get("packaged"))
|
if (!config.get("packaged"))
|
||||||
return callback();
|
return callback();
|
||||||
|
|
||||||
var base = mode.split("/").pop();
|
net.loadScript(config.moduleUrl(name, "mode"), callback);
|
||||||
var filename = config.get("modePath") + "/mode-" + base + ".js";
|
|
||||||
net.loadScript(filename, callback);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ function BracketMatch() {
|
||||||
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
chr = line.charAt(pos.column);
|
chr = line.charAt(pos.column);
|
||||||
pos.column++;
|
pos = {row: pos.row, column: pos.column + 1};
|
||||||
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
|
||||||
before = false;
|
before = false;
|
||||||
}
|
}
|
||||||
|
|
@ -123,9 +123,6 @@ function BracketMatch() {
|
||||||
range.cursor = range.start;
|
range.cursor = range.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!before)
|
|
||||||
pos.column--;
|
|
||||||
|
|
||||||
return range;
|
return range;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -194,7 +191,7 @@ function BracketMatch() {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$findClosingBracket = function(bracket, position, typeRe, allowBlankLine) {
|
this.$findClosingBracket = function(bracket, position, typeRe) {
|
||||||
var closingBracket = this.$brackets[bracket];
|
var closingBracket = this.$brackets[bracket];
|
||||||
var depth = 1;
|
var depth = 1;
|
||||||
|
|
||||||
|
|
@ -239,12 +236,6 @@ function BracketMatch() {
|
||||||
// whose type matches typeRe
|
// whose type matches typeRe
|
||||||
do {
|
do {
|
||||||
token = iterator.stepForward();
|
token = iterator.stepForward();
|
||||||
if (allowBlankLine) {
|
|
||||||
// if you've reached the doc end, or, you match a new content line
|
|
||||||
if (token === null || token.type == "string") {
|
|
||||||
return {row: iterator.getCurrentTokenRow() + (token === null ? 1 : -1), column: 0};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (token && !typeRe.test(token.type));
|
} while (token && !typeRe.test(token.type));
|
||||||
|
|
||||||
if (token == null)
|
if (token == null)
|
||||||
|
|
|
||||||
|
|
@ -1772,7 +1772,7 @@ var Editor = function(renderer, session) {
|
||||||
|
|
||||||
var range = this.session.getBracketRange(cursor);
|
var range = this.session.getBracketRange(cursor);
|
||||||
if (!range) {
|
if (!range) {
|
||||||
range = editor.find({
|
range = this.find({
|
||||||
needle: /[{}()\[\]]/g,
|
needle: /[{}()\[\]]/g,
|
||||||
preventScroll:true,
|
preventScroll:true,
|
||||||
start: {row: cursor.row, column: cursor.column - 1}
|
start: {row: cursor.row, column: cursor.column - 1}
|
||||||
|
|
@ -1787,7 +1787,7 @@ var Editor = function(renderer, session) {
|
||||||
pos = range && range.cursor || pos;
|
pos = range && range.cursor || pos;
|
||||||
if (pos) {
|
if (pos) {
|
||||||
if (select) {
|
if (select) {
|
||||||
if (range && range.isEqual(editor.getSelectionRange()))
|
if (range && range.isEqual(this.getSelectionRange()))
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
else
|
else
|
||||||
this.selection.selectTo(pos.row, pos.column);
|
this.selection.selectTo(pos.row, pos.column);
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ StateHandler.prototype = {
|
||||||
|
|
||||||
var bufferObj = {
|
var bufferObj = {
|
||||||
bufferToUse: bufferToUse,
|
bufferToUse: bufferToUse,
|
||||||
symbolicName: symbolicName,
|
symbolicName: symbolicName
|
||||||
};
|
};
|
||||||
|
|
||||||
if (e) {
|
if (e) {
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,16 @@ module.exports = {
|
||||||
editor.selection.selectLine();
|
editor.selection.selectLine();
|
||||||
registers._default.text += editor.getCopyText();
|
registers._default.text += editor.getCopyText();
|
||||||
var selRange = editor.getSelectionRange();
|
var selRange = editor.getSelectionRange();
|
||||||
|
// check if end of the document was reached
|
||||||
|
if (!selRange.isMultiLine()) {
|
||||||
|
lastLineReached = true
|
||||||
|
var row = selRange.start.row - 1;
|
||||||
|
var col = editor.session.getLine(row).length
|
||||||
|
selRange.setStart(row, col);
|
||||||
|
editor.session.remove(selRange);
|
||||||
|
editor.selection.clearSelection();
|
||||||
|
break;
|
||||||
|
}
|
||||||
editor.session.remove(selRange);
|
editor.session.remove(selRange);
|
||||||
editor.selection.clearSelection();
|
editor.selection.clearSelection();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ var Marker = function(parentEl) {
|
||||||
|
|
||||||
|
|
||||||
var html = [];
|
var html = [];
|
||||||
for ( var key in this.markers) {
|
for (var key in this.markers) {
|
||||||
var marker = this.markers[key];
|
var marker = this.markers[key];
|
||||||
|
|
||||||
if (!marker.range) {
|
if (!marker.range) {
|
||||||
|
|
@ -140,29 +140,25 @@ var Marker = function(parentEl) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Draws a multi line marker, where lines span the full width
|
// Draws a multi line marker, where lines span the full width
|
||||||
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
|
this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, type) {
|
||||||
var padding = type === "background" ? 0 : this.$padding;
|
var padding = type === "background" ? 0 : this.$padding;
|
||||||
var layerWidth = layerConfig.width + 2 * this.$padding - padding;
|
|
||||||
// from selection start to the end of the line
|
// from selection start to the end of the line
|
||||||
var height = layerConfig.lineHeight;
|
var height = config.lineHeight;
|
||||||
var width = Math.round(layerWidth - (range.start.column * layerConfig.characterWidth));
|
var top = this.$getTop(range.start.row, config);
|
||||||
var top = this.$getTop(range.start.row, layerConfig);
|
var left = Math.round(padding + range.start.column * config.characterWidth);
|
||||||
var left = Math.round(
|
|
||||||
padding + range.start.column * layerConfig.characterWidth
|
|
||||||
);
|
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, " start' style='",
|
"<div class='", clazz, " start' style='",
|
||||||
"height:", height, "px;",
|
"height:", height, "px;",
|
||||||
"width:", width, "px;",
|
"right:0;",
|
||||||
"top:", top, "px;",
|
"top:", top, "px;",
|
||||||
"left:", left, "px;'></div>"
|
"left:", left, "px;'></div>"
|
||||||
);
|
);
|
||||||
|
|
||||||
// from start of the last line to the selection end
|
// from start of the last line to the selection end
|
||||||
top = this.$getTop(range.end.row, layerConfig);
|
top = this.$getTop(range.end.row, config);
|
||||||
width = Math.round(range.end.column * layerConfig.characterWidth);
|
var width = Math.round(range.end.column * config.characterWidth);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
|
|
@ -173,15 +169,15 @@ var Marker = function(parentEl) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// all the complete lines
|
// all the complete lines
|
||||||
height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
|
height = (range.end.row - range.start.row - 1) * config.lineHeight;
|
||||||
if (height < 0)
|
if (height < 0)
|
||||||
return;
|
return;
|
||||||
top = this.$getTop(range.start.row + 1, layerConfig);
|
top = this.$getTop(range.start.row + 1, config);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
"height:", height, "px;",
|
"height:", height, "px;",
|
||||||
"width:", layerWidth, "px;",
|
"right:0;",
|
||||||
"top:", top, "px;",
|
"top:", top, "px;",
|
||||||
"left:", padding, "px;'></div>"
|
"left:", padding, "px;'></div>"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -510,9 +510,9 @@ var Text = function(parentEl) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$renderFoldLine = function(stringBuilder, row, tokens, onlyContents) {
|
this.$renderFoldLine = function(stringBuilder, row, tokens, onlyContents) {
|
||||||
var session = this.session,
|
var session = this.session;
|
||||||
foldLine = session.getFoldLine(row),
|
var foldLine = session.getFoldLine(row);
|
||||||
renderTokens = [];
|
var renderTokens = [];
|
||||||
|
|
||||||
function addTokens(tokens, from, to) {
|
function addTokens(tokens, from, to) {
|
||||||
var idx = 0, col = 0;
|
var idx = 0, col = 0;
|
||||||
|
|
@ -520,16 +520,14 @@ var Text = function(parentEl) {
|
||||||
col += tokens[idx].value.length;
|
col += tokens[idx].value.length;
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
if (idx == tokens.length) {
|
if (idx == tokens.length)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (col != from) {
|
if (col != from) {
|
||||||
var value = tokens[idx].value.substring(from - col);
|
var value = tokens[idx].value.substring(from - col);
|
||||||
// Check if the token value is longer then the from...to spacing.
|
// Check if the token value is longer then the from...to spacing.
|
||||||
if (value.length > (to - from)) {
|
if (value.length > (to - from))
|
||||||
value = value.substring(0, to - from);
|
value = value.substring(0, to - from);
|
||||||
}
|
|
||||||
|
|
||||||
renderTokens.push({
|
renderTokens.push({
|
||||||
type: tokens[idx].type,
|
type: tokens[idx].type,
|
||||||
|
|
@ -540,15 +538,15 @@ var Text = function(parentEl) {
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (col < to) {
|
while (col < to && idx < tokens.length) {
|
||||||
var value = tokens[idx].value;
|
var value = tokens[idx].value;
|
||||||
if (value.length + col > to) {
|
if (value.length + col > to) {
|
||||||
value = value.substring(0, to - col);
|
renderTokens.push({
|
||||||
}
|
type: tokens[idx].type,
|
||||||
renderTokens.push({
|
value: value.substring(0, to - col)
|
||||||
type: tokens[idx].type,
|
});
|
||||||
value: value
|
} else
|
||||||
});
|
renderTokens.push(tokens[idx]);
|
||||||
col += value.length;
|
col += value.length;
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -556,21 +554,21 @@ var Text = function(parentEl) {
|
||||||
|
|
||||||
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
||||||
if (placeholder) {
|
if (placeholder) {
|
||||||
renderTokens.push({
|
renderTokens.push({
|
||||||
type: "fold",
|
type: "fold",
|
||||||
value: placeholder
|
value: placeholder
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (isNewRow)
|
if (isNewRow)
|
||||||
tokens = this.session.getTokens(row);
|
tokens = session.getTokens(row);
|
||||||
|
|
||||||
if (tokens.length)
|
if (tokens.length)
|
||||||
addTokens(tokens, lastColumn, column);
|
addTokens(tokens, lastColumn, column);
|
||||||
}
|
}
|
||||||
}.bind(this), foldLine.end.row, this.session.getLine(foldLine.end.row).length);
|
}, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
|
||||||
|
|
||||||
// TODO: Build a fake splits array!
|
// splits for foldline are stored at its' first row
|
||||||
var splits = this.session.$useWrapMode?this.session.$wrapData[row]:null;
|
var splits = this.session.$useWrapMode ? this.session.$wrapData[row] : null;
|
||||||
this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
|
this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
||||||
|
|
||||||
function normalizeCommandKeys(callback, e, keyCode) {
|
function normalizeCommandKeys(callback, e, keyCode) {
|
||||||
var hashId = 0;
|
var hashId = 0;
|
||||||
if (useragent.isOpera && useragent.isMac) {
|
if ((useragent.isOpera && !("KeyboardEvent" in window)) && useragent.isMac) {
|
||||||
hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
|
hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
|
||||||
| (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
|
| (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -268,7 +268,7 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
||||||
|
|
||||||
exports.addCommandKeyListener = function(el, callback) {
|
exports.addCommandKeyListener = function(el, callback) {
|
||||||
var addListener = exports.addListener;
|
var addListener = exports.addListener;
|
||||||
if (useragent.isOldGecko || useragent.isOpera) {
|
if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) {
|
||||||
// Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
|
// Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
|
||||||
// event if the user pressed the key for a longer time. Instead, the
|
// event if the user pressed the key for a longer time. Instead, the
|
||||||
// keydown event was fired once and later on only the keypress event.
|
// keydown event was fired once and later on only the keypress event.
|
||||||
|
|
|
||||||
98
lib/ace/mode/behaviour/html.js
Normal file
98
lib/ace/mode/behaviour/html.js
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
/* vim:ts=4:sts=4:sw=4:
|
||||||
|
* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Chris Spencer <chris.ag.spencer AT googlemail DOT com>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
|
||||||
|
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||||
|
|
||||||
|
function hasType(token, type) {
|
||||||
|
var hasType = true;
|
||||||
|
var typeList = token.type.split('.');
|
||||||
|
var needleList = type.split('.');
|
||||||
|
needleList.forEach(function(needle){
|
||||||
|
if (typeList.indexOf(needle) == -1) {
|
||||||
|
hasType = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return hasType;
|
||||||
|
}
|
||||||
|
|
||||||
|
var HtmlBehaviour = function () {
|
||||||
|
|
||||||
|
this.inherit(XmlBehaviour); // Get xml behaviour
|
||||||
|
|
||||||
|
this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
|
||||||
|
if (text == '>') {
|
||||||
|
var position = editor.getCursorPosition();
|
||||||
|
var iterator = new TokenIterator(session, position.row, position.column);
|
||||||
|
var token = iterator.getCurrentToken();
|
||||||
|
var atCursor = false;
|
||||||
|
if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
||||||
|
do {
|
||||||
|
token = iterator.stepBackward();
|
||||||
|
} while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
|
||||||
|
} else {
|
||||||
|
atCursor = true;
|
||||||
|
}
|
||||||
|
if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var element = token.value;
|
||||||
|
if (atCursor){
|
||||||
|
var element = element.substring(0, position.column - token.start);
|
||||||
|
}
|
||||||
|
if (voidElements.indexOf(element) !== -1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
text: '>' + '</' + element + '>',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
oop.inherits(HtmlBehaviour, XmlBehaviour);
|
||||||
|
|
||||||
|
exports.HtmlBehaviour = HtmlBehaviour;
|
||||||
|
});
|
||||||
|
|
@ -42,34 +42,55 @@ define(function(require, exports, module) {
|
||||||
var oop = require("../../lib/oop");
|
var oop = require("../../lib/oop");
|
||||||
var Behaviour = require("../behaviour").Behaviour;
|
var Behaviour = require("../behaviour").Behaviour;
|
||||||
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
||||||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
|
||||||
|
function hasType(token, type) {
|
||||||
|
var hasType = true;
|
||||||
|
var typeList = token.type.split('.');
|
||||||
|
var needleList = type.split('.');
|
||||||
|
needleList.forEach(function(needle){
|
||||||
|
if (typeList.indexOf(needle) == -1) {
|
||||||
|
hasType = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return hasType;
|
||||||
|
}
|
||||||
|
|
||||||
var XmlBehaviour = function () {
|
var XmlBehaviour = function () {
|
||||||
|
|
||||||
this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
|
this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
|
||||||
|
|
||||||
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '<') {
|
if (text == '>') {
|
||||||
var selection = editor.getSelectionRange();
|
var position = editor.getCursorPosition();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var iterator = new TokenIterator(session, position.row, position.column);
|
||||||
if (selected !== "") {
|
var token = iterator.getCurrentToken();
|
||||||
return false;
|
var atCursor = false;
|
||||||
|
if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
||||||
|
do {
|
||||||
|
token = iterator.stepBackward();
|
||||||
|
} while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
|
||||||
} else {
|
} else {
|
||||||
return {
|
atCursor = true;
|
||||||
text: '<>',
|
|
||||||
selection: [1, 1]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (text == '>') {
|
if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
|
||||||
var cursor = editor.getCursorPosition();
|
return
|
||||||
var line = session.doc.getLine(cursor.row);
|
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
|
||||||
if (rightChar == '>') { // need some kind of matching check here
|
|
||||||
return {
|
|
||||||
text: '',
|
|
||||||
selection: [1, 1]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
var tag = token.value;
|
||||||
|
if (atCursor){
|
||||||
|
var tag = tag.substring(0, position.column - token.start);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
text: '>' + '</' + tag + '>',
|
||||||
|
selection: [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
|
||||||
|
if (text == "\n") {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
var rightChars = line.substring(cursor.column, cursor.column + 2);
|
var rightChars = line.substring(cursor.column, cursor.column + 2);
|
||||||
|
|
|
||||||
|
|
@ -56,18 +56,6 @@ oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
// ignore braces in comments
|
|
||||||
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
|
||||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
|
||||||
return indent;
|
|
||||||
}
|
|
||||||
|
|
||||||
var match = line.match(/^.*\{\s*$/);
|
|
||||||
if (match) {
|
|
||||||
indent += tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
return indent;
|
return indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ define(function(require, exports, module) {
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
|
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
|
||||||
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
var PythonFoldMode = require("./folding/pythonic").FoldMode;
|
var PythonFoldMode = require("./folding/coffee").FoldMode;
|
||||||
var Range = require("../range").Range;
|
var Range = require("../range").Range;
|
||||||
var TextMode = require("./text").Mode;
|
var TextMode = require("./text").Mode;
|
||||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
|
|
@ -100,7 +100,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
var worker = new WorkerClient(["ace"], "worker-coffee.js", "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("error", function(e) {
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ define(function(require, exports, module) {
|
||||||
regex : "\\?|\\:|\\,|\\."
|
regex : "\\?|\\:|\\,|\\."
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "(?:[\\-=]>|[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|\\!)"
|
regex : "(?:[\\-=]>|[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[({[]"
|
regex : "[({[]"
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
var worker = new WorkerClient(["ace"], "worker-css.js", "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("csslint", function(e) {
|
||||||
|
|
|
||||||
|
|
@ -48,46 +48,32 @@ oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
this.foldingStartMarker = /[a-zA-Z](:)\s*$/;
|
this.foldingStartMarker = /^(\w.*\:|Searching for.*)$/;
|
||||||
this.foldingStopMarker = /^(\s*)$/;
|
this.foldingStopMarker = /^(\s+|Found.*)$/;
|
||||||
|
|
||||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
var line = session.getLine(row);
|
var line = session.getLine(row);
|
||||||
var match = line.match(this.foldingStartMarker);
|
var level1 = /^(Found.*|Searching for.*)$/;
|
||||||
if (match) {
|
var level2 = /^(\w.*\:|\s*)$/;
|
||||||
var i = match.index;
|
var re = level1.test(line) ? level1 : level2;
|
||||||
|
|
||||||
if (match[1])
|
if (this.foldingStartMarker.test(line)) {
|
||||||
return this.openingBracketBlock(session, match[1], row, i, false, true);
|
for (var i = row + 1, l = session.getLength(); i < l; i++) {
|
||||||
|
if (re.test(session.getLine(i)))
|
||||||
var range = session.getCommentFoldRange(row, i + match[0].length);
|
break;
|
||||||
range.end.column -= 2;
|
|
||||||
return range;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foldStyle !== "markbeginend")
|
|
||||||
return;
|
|
||||||
|
|
||||||
var match = line.match(this.foldingStopMarker);
|
|
||||||
if (match) {
|
|
||||||
var i = match.index + match[0].length;
|
|
||||||
|
|
||||||
if (match[2]) {
|
|
||||||
var range = session.getCommentFoldRange(row, i);
|
|
||||||
range.end.column -= 2;
|
|
||||||
return range;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var end = {row: row, column: i};
|
return new Range(row, line.length, i, 0);
|
||||||
var start = session.$findOpeningBracket(match[1], end);
|
}
|
||||||
|
|
||||||
if (!start)
|
if (this.foldingStopMarker.test(line)) {
|
||||||
return;
|
for (var i = row - 1; i >= 0; i--) {
|
||||||
|
line = session.getLine(i);
|
||||||
|
if (re.test(line))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
start.column++;
|
return new Range(i, line.length, row, 0);
|
||||||
end.column--;
|
|
||||||
|
|
||||||
return Range.fromPoints(start, end);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
127
lib/ace/mode/folding/coffee.js
Normal file
127
lib/ace/mode/folding/coffee.js
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var range = this.indentationBlock(session, row);
|
||||||
|
if (range)
|
||||||
|
return range;
|
||||||
|
|
||||||
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1 || line[startLevel] != "#")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.search(re);
|
||||||
|
|
||||||
|
if (level == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[level] != "#")
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// must return "" if there's no fold, to enable caching
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var indent = line.search(/\S/);
|
||||||
|
var next = session.getLine(row + 1);
|
||||||
|
var prev = session.getLine(row - 1);
|
||||||
|
var prevIndent = prev.search(/\S/);
|
||||||
|
var nextIndent = next.search(/\S/);
|
||||||
|
|
||||||
|
if (indent == -1) {
|
||||||
|
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// documentation comments
|
||||||
|
if (prevIndent == -1) {
|
||||||
|
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return "start";
|
||||||
|
}
|
||||||
|
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
||||||
|
if (session.getLine(row - 2).search(/\S/) == -1) {
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
session.foldWidgets[row + 1] = "";
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevIndent!= -1 && prevIndent < indent)
|
||||||
|
session.foldWidgets[row - 1] = "start";
|
||||||
|
else
|
||||||
|
session.foldWidgets[row - 1] = "";
|
||||||
|
|
||||||
|
if (indent < nextIndent)
|
||||||
|
return "start";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
108
lib/ace/mode/folding/coffee_test.js
Normal file
108
lib/ace/mode/folding/coffee_test.js
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
if (typeof process !== "undefined")
|
||||||
|
require("amd-loader");
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var CoffeeMode = require("../coffee").Mode;
|
||||||
|
var EditSession = require("../../edit_session").EditSession;
|
||||||
|
var assert = require("../../test/assertions");
|
||||||
|
function testFoldWidgets(array) {
|
||||||
|
var session = array.filter(function(_, i){return i % 2 == 1});
|
||||||
|
session = new EditSession(session);
|
||||||
|
var mode = new CoffeeMode();
|
||||||
|
session.setFoldStyle("markbeginend");
|
||||||
|
session.setMode(mode);
|
||||||
|
|
||||||
|
var widgets = array.filter(function(_, i){return i % 2 == 0});
|
||||||
|
widgets.forEach(function(w, i){
|
||||||
|
session.foldWidgets[i] = session.getFoldWidget(i);
|
||||||
|
})
|
||||||
|
widgets.forEach(function(w, i){
|
||||||
|
w = w.split(",");
|
||||||
|
var type = w[0] == ">" ? "start" : w[0] == "<" ? "end" : "";
|
||||||
|
assert.equal(session.foldWidgets[i], type);
|
||||||
|
if (!type)
|
||||||
|
return;
|
||||||
|
var range = session.getFoldWidgetRange(i);
|
||||||
|
if (!w[1]) {
|
||||||
|
assert.equal(range, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert.equal(range.start.row, i);
|
||||||
|
assert.equal(range.end.row - range.start.row, parseInt(w[1]));
|
||||||
|
testColumn(w[2], range.start);
|
||||||
|
testColumn(w[3], range.end);
|
||||||
|
});
|
||||||
|
|
||||||
|
function testColumn(w, pos) {
|
||||||
|
if (!w)
|
||||||
|
return;
|
||||||
|
if (w == "l")
|
||||||
|
w = session.getLine(pos.row).length;
|
||||||
|
else
|
||||||
|
w = parseInt(w);
|
||||||
|
assert.equal(pos.column, w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
"test: coffee script indentation based folding": function() {
|
||||||
|
testFoldWidgets([
|
||||||
|
'>,1,l,l', ' ## indented comment',
|
||||||
|
'', ' # ',
|
||||||
|
'', '',
|
||||||
|
'>,1,l,l', ' # plain comment',
|
||||||
|
'', ' # ',
|
||||||
|
'>,2', ' function (x)=>',
|
||||||
|
'', ' ',
|
||||||
|
'', ' x++',
|
||||||
|
'', ' ',
|
||||||
|
'', ' ',
|
||||||
|
'>,2', ' bar = ',
|
||||||
|
'', ' foo: 1',
|
||||||
|
'', ' baz: lighter'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (typeof module !== "undefined" && module === require.main)
|
||||||
|
require("asyncjs").test.testcase(module.exports).exec();
|
||||||
|
|
@ -64,19 +64,21 @@ var FoldMode = exports.FoldMode = function() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
this.indentationBlock = function(session, row, column) {
|
this.indentationBlock = function(session, row, column) {
|
||||||
var re = /^\s*/;
|
var re = /\S/;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startLevel = line.search(re);
|
||||||
|
if (startLevel == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startColumn = column || line.length;
|
||||||
|
var maxRow = session.getLength();
|
||||||
var startRow = row;
|
var startRow = row;
|
||||||
var endRow = row;
|
var endRow = row;
|
||||||
var line = session.getLine(row);
|
|
||||||
var startColumn = column || line.length;
|
|
||||||
var startLevel = line.match(re)[0].length;
|
|
||||||
var maxRow = session.getLength()
|
|
||||||
|
|
||||||
while (++row < maxRow) {
|
while (++row < maxRow) {
|
||||||
line = session.getLine(row);
|
var level = session.getLine(row).search(re);
|
||||||
var level = line.match(re)[0].length;
|
|
||||||
|
|
||||||
if (level == line.length)
|
if (level == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (level <= startLevel)
|
if (level <= startLevel)
|
||||||
|
|
@ -91,9 +93,9 @@ var FoldMode = exports.FoldMode = function() {};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.openingBracketBlock = function(session, bracket, row, column, typeRe, allowBlankLine) {
|
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
|
||||||
var start = {row: row, column: column + 1};
|
var start = {row: row, column: column + 1};
|
||||||
var end = session.$findClosingBracket(bracket, start, typeRe, allowBlankLine);
|
var end = session.$findClosingBracket(bracket, start, typeRe);
|
||||||
if (!end)
|
if (!end)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -101,7 +103,7 @@ var FoldMode = exports.FoldMode = function() {};
|
||||||
if (fw == null)
|
if (fw == null)
|
||||||
fw = this.getFoldWidget(session, end.row);
|
fw = this.getFoldWidget(session, end.row);
|
||||||
|
|
||||||
if (fw == "start") {
|
if (fw == "start" && end.row > start.row) {
|
||||||
end.row --;
|
end.row --;
|
||||||
end.column = session.getLine(end.row).length;
|
end.column = session.getLine(end.row).length;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ var oop = require("../../lib/oop");
|
||||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
var FoldMode = exports.FoldMode = function(markers) {
|
var FoldMode = exports.FoldMode = function(markers) {
|
||||||
this.foldingStartMarker = new RegExp("(?:([\\[{])|(" + markers + "))(?:\\s*)(?:#.*)?$");
|
this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
|
||||||
};
|
};
|
||||||
oop.inherits(FoldMode, BaseFoldMode);
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,12 @@ module.exports = {
|
||||||
|
|
||||||
"test: bracket folding": function() {
|
"test: bracket folding": function() {
|
||||||
var session = new EditSession([
|
var session = new EditSession([
|
||||||
'[ #-',
|
'[ ',
|
||||||
'stuff',
|
'stuff',
|
||||||
']',
|
']',
|
||||||
'[ ',
|
'[ ',
|
||||||
'{ '
|
'{ ',
|
||||||
|
'[ #-',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var mode = new PythonMode();
|
var mode = new PythonMode();
|
||||||
|
|
@ -65,9 +66,11 @@ module.exports = {
|
||||||
assert.equal(session.getFoldWidget(2), "");
|
assert.equal(session.getFoldWidget(2), "");
|
||||||
assert.equal(session.getFoldWidget(3), "start");
|
assert.equal(session.getFoldWidget(3), "start");
|
||||||
assert.equal(session.getFoldWidget(4), "start");
|
assert.equal(session.getFoldWidget(4), "start");
|
||||||
|
assert.equal(session.getFoldWidget(5), "");
|
||||||
|
|
||||||
assert.range(session.getFoldWidgetRange(0), 0, 1, 2, 0);
|
assert.range(session.getFoldWidgetRange(0), 0, 1, 2, 0);
|
||||||
assert.equal(session.getFoldWidgetRange(3), null);
|
assert.equal(session.getFoldWidgetRange(3), null);
|
||||||
|
assert.equal(session.getFoldWidgetRange(5), null);
|
||||||
},
|
},
|
||||||
|
|
||||||
"test: indentation folding": function() {
|
"test: indentation folding": function() {
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ var JavaScriptMode = require("./javascript").Mode;
|
||||||
var CssMode = require("./css").Mode;
|
var CssMode = require("./css").Mode;
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||||
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
|
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
|
||||||
var HtmlFoldMode = require("./folding/html").FoldMode;
|
var HtmlFoldMode = require("./folding/html").FoldMode;
|
||||||
|
|
||||||
var Mode = function() {
|
var Mode = function() {
|
||||||
var highlighter = new HtmlHighlightRules();
|
var highlighter = new HtmlHighlightRules();
|
||||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||||
this.$behaviour = new XmlBehaviour();
|
this.$behaviour = new HtmlBehaviour();
|
||||||
|
|
||||||
this.$embeds = highlighter.getEmbeds();
|
this.$embeds = highlighter.getEmbeds();
|
||||||
this.createModeDelegates({
|
this.createModeDelegates({
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,25 @@ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScrip
|
||||||
var xmlUtil = require("./xml_util");
|
var xmlUtil = require("./xml_util");
|
||||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var tagMap = {
|
||||||
|
a : 'anchor',
|
||||||
|
button : 'form',
|
||||||
|
form : 'form',
|
||||||
|
img : 'image',
|
||||||
|
input : 'form',
|
||||||
|
label : 'form',
|
||||||
|
script : 'script',
|
||||||
|
select : 'form',
|
||||||
|
textarea : 'form',
|
||||||
|
style : 'style',
|
||||||
|
table : 'table',
|
||||||
|
tbody : 'table',
|
||||||
|
td : 'table',
|
||||||
|
tfoot : 'table',
|
||||||
|
th : 'table',
|
||||||
|
tr : 'table'
|
||||||
|
};
|
||||||
|
|
||||||
var HtmlHighlightRules = function() {
|
var HtmlHighlightRules = function() {
|
||||||
|
|
||||||
// regexp must not have capturing parentheses
|
// regexp must not have capturing parentheses
|
||||||
|
|
@ -113,9 +132,9 @@ var HtmlHighlightRules = function() {
|
||||||
} ]
|
} ]
|
||||||
};
|
};
|
||||||
|
|
||||||
xmlUtil.tag(this.$rules, "tag", "start");
|
xmlUtil.tag(this.$rules, "tag", "start", tagMap);
|
||||||
xmlUtil.tag(this.$rules, "style", "css-start");
|
xmlUtil.tag(this.$rules, "style", "css-start", tagMap);
|
||||||
xmlUtil.tag(this.$rules, "script", "js-start");
|
xmlUtil.tag(this.$rules, "script", "js-start", tagMap);
|
||||||
|
|
||||||
this.embedRules(JavaScriptHighlightRules, "js-", [{
|
this.embedRules(JavaScriptHighlightRules, "js-", [{
|
||||||
token: "comment",
|
token: "comment",
|
||||||
|
|
|
||||||
|
|
@ -45,46 +45,146 @@ define(function(require, exports, module) {
|
||||||
var HtmlMode = require("./html").Mode;
|
var HtmlMode = require("./html").Mode;
|
||||||
var assert = require("../test/assertions");
|
var assert = require("../test/assertions");
|
||||||
|
|
||||||
|
var testData = {
|
||||||
|
"test: tokenize embedded script" : [{
|
||||||
|
text: "<script a='a'>var</script>'123'",
|
||||||
|
state: ["start", "start"],
|
||||||
|
tokens: [{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "<"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag.tag-name.script",
|
||||||
|
value: "script"
|
||||||
|
}, {
|
||||||
|
type: "text",
|
||||||
|
value: " "
|
||||||
|
}, {
|
||||||
|
type: "entity.other.attribute-name",
|
||||||
|
value: "a"
|
||||||
|
}, {
|
||||||
|
type: "keyword.operator",
|
||||||
|
value: "="
|
||||||
|
}, {
|
||||||
|
type: "string",
|
||||||
|
value: "'a'"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
}, {
|
||||||
|
type: "storage.type",
|
||||||
|
value: "var"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "</"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag.tag-name.script",
|
||||||
|
value: "script"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
}, {
|
||||||
|
type: "text",
|
||||||
|
value: "'123'"
|
||||||
|
}]
|
||||||
|
}],
|
||||||
|
|
||||||
|
"test: tokenize multiline attribute value with double quotes": [{
|
||||||
|
text: "<a href=\"abc",
|
||||||
|
state: [ "start", "tag_qqstring"],
|
||||||
|
tokens: [{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "<"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag.tag-name.anchor",
|
||||||
|
value: "a"
|
||||||
|
}, {
|
||||||
|
type: "text",
|
||||||
|
value: " "
|
||||||
|
}, {
|
||||||
|
type: "entity.other.attribute-name",
|
||||||
|
value: "href"
|
||||||
|
}, {
|
||||||
|
type: "keyword.operator",
|
||||||
|
value: "="
|
||||||
|
}, {
|
||||||
|
type: "string",
|
||||||
|
value: "\"abc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
text: "def\">",
|
||||||
|
state: [ "tag_qqstring", "start" ],
|
||||||
|
tokens: [ {
|
||||||
|
type: "string",
|
||||||
|
value: "def\""
|
||||||
|
}, {
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
"test: tokenize multiline attribute value with single quotes": [{
|
||||||
|
text: "<a href='abc",
|
||||||
|
state: ["start", "tag_qstring"],
|
||||||
|
tokens: [{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "<"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag.tag-name.anchor",
|
||||||
|
value: "a"
|
||||||
|
}, {
|
||||||
|
type: "text",
|
||||||
|
value: " "
|
||||||
|
}, {
|
||||||
|
type: "entity.other.attribute-name",
|
||||||
|
value: "href"
|
||||||
|
}, {
|
||||||
|
type: "keyword.operator",
|
||||||
|
value: "="
|
||||||
|
}, {
|
||||||
|
type: "string",
|
||||||
|
value: "'abc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
text: "def\"'>",
|
||||||
|
state: [ "tag_qstring", "start" ],
|
||||||
|
tokens: [ {
|
||||||
|
type: "string",
|
||||||
|
value: "def\"'"
|
||||||
|
}, {
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
function generateTest(exampleData) {
|
||||||
|
return function testTokenizer() {
|
||||||
|
for (var i = 0; i < exampleData.length; i++) {
|
||||||
|
var s = exampleData[i];
|
||||||
|
var lineTokens = tokenizer.getLineTokens(s.text, s.state[0]);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
JSON.stringify(lineTokens, null, 4),
|
||||||
|
JSON.stringify({tokens:s.tokens, state: s.state[1]}, null, 4)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tokenizer;
|
||||||
module.exports = {
|
module.exports = {
|
||||||
setUp : function() {
|
setUp : function() {
|
||||||
this.tokenizer = new HtmlMode().getTokenizer();
|
tokenizer = new HtmlMode().getTokenizer();
|
||||||
},
|
|
||||||
|
|
||||||
"test: tokenize embedded script" : function() {
|
|
||||||
var line = "<script a='a'>var</script>'123'";
|
|
||||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
|
||||||
|
|
||||||
assert.equal(12, tokens.length);
|
|
||||||
assert.equal("meta.tag", tokens[0].type);
|
|
||||||
assert.equal("meta.tag.script", tokens[1].type);
|
|
||||||
assert.equal("text", tokens[2].type);
|
|
||||||
assert.equal("entity.other.attribute-name", tokens[3].type);
|
|
||||||
assert.equal("keyword.operator", tokens[4].type);
|
|
||||||
assert.equal("string", tokens[5].type);
|
|
||||||
assert.equal("meta.tag", tokens[6].type);
|
|
||||||
assert.equal("storage.type", tokens[7].type);
|
|
||||||
assert.equal("meta.tag", tokens[8].type);
|
|
||||||
assert.equal("meta.tag.script", tokens[9].type);
|
|
||||||
assert.equal("meta.tag", tokens[10].type);
|
|
||||||
assert.equal("text", tokens[11].type);
|
|
||||||
},
|
|
||||||
|
|
||||||
"test: tokenize multiline attribute value with double quotes": function() {
|
|
||||||
var line1 = this.tokenizer.getLineTokens('<a href="abc', "start");
|
|
||||||
var t1 = line1.tokens;
|
|
||||||
var t2 = this.tokenizer.getLineTokens('def">', line1.state).tokens;
|
|
||||||
assert.equal(t1[t1.length-1].type, "string");
|
|
||||||
assert.equal(t2[0].type, "string");
|
|
||||||
},
|
|
||||||
|
|
||||||
"test: tokenize multiline attribute value with single quotes": function() {
|
|
||||||
var line1 = this.tokenizer.getLineTokens("<a href='abc", "start");
|
|
||||||
var t1 = line1.tokens;
|
|
||||||
var t2 = this.tokenizer.getLineTokens('def\'>', line1.state).tokens;
|
|
||||||
assert.equal(t1[t1.length-1].type, "string");
|
|
||||||
assert.equal(t2[0].type, "string");
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
for (var i in testData) {
|
||||||
|
module.exports[i] = generateTest(testData[i])
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
var worker = new WorkerClient(["ace"], "worker-javascript.js", "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("jslint", function(results) {
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ var JavaScriptHighlightRules = function() {
|
||||||
"function_arguments": [
|
"function_arguments": [
|
||||||
{
|
{
|
||||||
token: "variable.parameter",
|
token: "variable.parameter",
|
||||||
regex: identifierRe,
|
regex: identifierRe
|
||||||
}, {
|
}, {
|
||||||
token: "punctuation.operator",
|
token: "punctuation.operator",
|
||||||
regex: "[, ]+",
|
regex: "[, ]+",
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
var worker = new WorkerClient(["ace"], "worker-json.js", "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("error", function(e) {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
* Colin Gourlay <colin DOT j DOT gourlay AT gmail DOT com>
|
* Colin Gourlay <colin DOT j DOT gourlay AT gmail DOT com>
|
||||||
* Lee Gao
|
* Lee Gao
|
||||||
|
* Tim Starling
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
|
@ -44,6 +45,7 @@ var oop = require("../lib/oop");
|
||||||
var TextMode = require("./text").Mode;
|
var TextMode = require("./text").Mode;
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
var Mode = function() {
|
var Mode = function() {
|
||||||
this.$tokenizer = new Tokenizer(new LuaHighlightRules().getRules());
|
this.$tokenizer = new Tokenizer(new LuaHighlightRules().getRules());
|
||||||
|
|
@ -51,34 +53,100 @@ var Mode = function() {
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
var indentKeywords = {
|
||||||
|
"function": 1,
|
||||||
|
"then": 1,
|
||||||
|
"do": 1,
|
||||||
|
"else": 1,
|
||||||
|
"elseif": 1,
|
||||||
|
"repeat": 1,
|
||||||
|
"end": -1,
|
||||||
|
"until": -1,
|
||||||
|
};
|
||||||
|
var outdentKeywords = [
|
||||||
|
"else",
|
||||||
|
"elseif",
|
||||||
|
"end",
|
||||||
|
"until"
|
||||||
|
];
|
||||||
|
|
||||||
|
function getNetIndentLevel(tokens) {
|
||||||
|
var level = 0;
|
||||||
|
// Support single-line blocks by decrementing the indent level if
|
||||||
|
// an ending token is found
|
||||||
|
for (var i in tokens){
|
||||||
|
var token = tokens[i];
|
||||||
|
if (token.type == "keyword") {
|
||||||
|
if (token.value in indentKeywords) {
|
||||||
|
level += indentKeywords[token.value];
|
||||||
|
}
|
||||||
|
} else if (token.type == "paren.lparen") {
|
||||||
|
level ++;
|
||||||
|
} else if (token.type == "paren.rparen") {
|
||||||
|
level --;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Limit the level to +/- 1 since usually users only indent one level
|
||||||
|
// at a time regardless of the logical nesting level
|
||||||
|
if (level < 0) {
|
||||||
|
return -1;
|
||||||
|
} else if (level > 0) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
var level = 0;
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||||
var tokens = tokenizedLine.tokens;
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
var chunks = ["function", "then", "do", "repeat"];
|
|
||||||
|
|
||||||
if (state == "start") {
|
if (state == "start") {
|
||||||
var match = line.match(/^.*[\{\(\[]\s*$/);
|
level = getNetIndentLevel(tokens);
|
||||||
if (match) {
|
}
|
||||||
indent += tab;
|
if (level > 0) {
|
||||||
} else {
|
return indent + tab;
|
||||||
for (var i in tokens){
|
} else if (level < 0 && indent.substr(indent.length - tab.length) == tab) {
|
||||||
var token = tokens[i];
|
// Don't do a next-line outdent if we're going to do a real outdent of this line
|
||||||
if (token.type != "keyword") continue;
|
if (!this.checkOutdent(state, line, "\n")) {
|
||||||
var chunk_i = chunks.indexOf(token.value);
|
return indent.substr(0, indent.length - tab.length);
|
||||||
if (chunk_i != -1){
|
|
||||||
indent += tab;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return indent;
|
return indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
if (input != "\n" && input != "\r" && input != "\r\n")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (line.match(/^\s*[\)\}\]]$/))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
|
||||||
|
|
||||||
|
if (!tokens || !tokens.length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, session, row) {
|
||||||
|
var prevLine = session.getLine(row - 1);
|
||||||
|
var prevIndent = this.$getIndent(prevLine).length;
|
||||||
|
var prevTokens = this.$tokenizer.getLineTokens(prevLine, "start").tokens;
|
||||||
|
var tabLength = session.getTabString().length;
|
||||||
|
var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
|
||||||
|
var curIndent = this.$getIndent(session.getLine(row)).length;
|
||||||
|
if (curIndent < expectedIndent) {
|
||||||
|
// User already outdented //
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
session.outdentRows(new Range(row, 0, row + 2, 0));
|
||||||
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// LuaPage implements the LuaPage markup as described by the Kepler Project's CGILua
|
// LuaPage implements the LuaPage markup as described by the Kepler Project's CGILua
|
||||||
// documentation: http://keplerproject.github.com/cgilua/manual.html#templates
|
// documentation: http://keplerproject.github.com/cgilua/manual.html#templates
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
|
||||||
|
|
@ -45,57 +45,169 @@ define(function(require, exports, module) {
|
||||||
var XmlMode = require("./xml").Mode;
|
var XmlMode = require("./xml").Mode;
|
||||||
var assert = require("../test/assertions");
|
var assert = require("../test/assertions");
|
||||||
|
|
||||||
module.exports = {
|
var testData = {
|
||||||
|
"test: tokenize1" : [{
|
||||||
|
text: "<Juhu>//Juhu Kinners</Kinners>",
|
||||||
|
state: ["start", "start"],
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "<"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag.tag-name",
|
||||||
|
value: "Juhu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
value: "//Juhu Kinners"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "</"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag.tag-name",
|
||||||
|
value: "Kinners"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
"test: two tags in the same lines should be in separate tokens": [{
|
||||||
|
text: "<Juhu><Kinners>",
|
||||||
|
state: [ "start", "start"],
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "<"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag.tag-name",
|
||||||
|
value: "Juhu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "<"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag.tag-name",
|
||||||
|
value: "Kinners"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: ">"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
"test: multiline attributes": [{
|
||||||
|
text: "<copy set=\"{",
|
||||||
|
state: ["start", "tag_qqstring"],
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "<"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag.tag-name",
|
||||||
|
value: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
value: " "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "entity.other.attribute-name",
|
||||||
|
value: "set"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "keyword.operator",
|
||||||
|
value: "="
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "string",
|
||||||
|
value: "\"{"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
text: "}\" undo=\"{",
|
||||||
|
state: [ "tag_qqstring", "tag_qqstring"],
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
type: "string",
|
||||||
|
value: "}\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
value: " "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "entity.other.attribute-name",
|
||||||
|
value: "undo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "keyword.operator",
|
||||||
|
value: "="
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "string",
|
||||||
|
value: "\"{"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
text: "}\"/>",
|
||||||
|
state: ["tag_qqstring", "start"],
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
type: "string",
|
||||||
|
value: "}\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "meta.tag",
|
||||||
|
value: "/>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
function generateTest(exampleData) {
|
||||||
|
return function testTokenizer() {
|
||||||
|
for (var i = 0; i < exampleData.length; i++) {
|
||||||
|
var s = exampleData[i];
|
||||||
|
var lineTokens = tokenizer.getLineTokens(s.text, s.state[0]);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
JSON.stringify(lineTokens, null, 4),
|
||||||
|
JSON.stringify({tokens:s.tokens, state: s.state[1]}, null, 4)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tokenizer;
|
||||||
|
module.exports = {
|
||||||
name: "XML Tokenizer",
|
name: "XML Tokenizer",
|
||||||
|
|
||||||
setUp : function() {
|
setUp : function() {
|
||||||
this.tokenizer = new XmlMode().getTokenizer();
|
tokenizer = new XmlMode().getTokenizer();
|
||||||
},
|
|
||||||
|
|
||||||
"test: tokenize1" : function() {
|
|
||||||
var line = "<Juhu>//Juhu Kinners</Kinners>";
|
|
||||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
|
||||||
|
|
||||||
assert.equal(3, tokens.length);
|
|
||||||
assert.equal("meta.tag", tokens[0].type);
|
|
||||||
assert.equal("text", tokens[1].type);
|
|
||||||
assert.equal("meta.tag", tokens[2].type);
|
|
||||||
},
|
|
||||||
|
|
||||||
"test: two tags in the same lines should be in separate tokens" : function() {
|
|
||||||
var line = "<Juhu><Kinners>";
|
|
||||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
|
||||||
|
|
||||||
assert.equal(2, tokens.length);
|
|
||||||
assert.equal("meta.tag", tokens[0].type);
|
|
||||||
assert.equal("meta.tag", tokens[1].type);
|
|
||||||
|
|
||||||
assert.equal("<Juhu>", tokens[0].value);
|
|
||||||
assert.equal("<Kinners>", tokens[1].value);
|
|
||||||
},
|
|
||||||
|
|
||||||
"test: multiline attributes": function() {
|
|
||||||
var multiLine = ['<copy set="{', '}" undo="{', '}"/>'];
|
|
||||||
|
|
||||||
var state = "start";
|
|
||||||
var multiLineTokens = multiLine.map(function(line) {
|
|
||||||
var tokens = this.tokenizer.getLineTokens(line, state);
|
|
||||||
state = tokens.state;
|
|
||||||
return tokens.tokens;
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
assert.equal(multiLineTokens[0].length, 5);
|
|
||||||
assert.equal(multiLineTokens[1].length, 5);
|
|
||||||
assert.equal(multiLineTokens[2].length, 2);
|
|
||||||
|
|
||||||
assert.equal(multiLineTokens[0][4].type, "string");
|
|
||||||
assert.equal(multiLineTokens[1][0].type, "string");
|
|
||||||
assert.equal(multiLineTokens[1][4].type, "string");
|
|
||||||
assert.equal(multiLineTokens[2][0].type, "string");
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
for (var i in testData) {
|
||||||
|
module.exports[i] = generateTest(testData[i])
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof module !== "undefined" && module === require.main) {
|
if (typeof module !== "undefined" && module === require.main) {
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,6 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var lang = require("../lib/lang");
|
|
||||||
|
|
||||||
var formTags = lang.arrayToMap(
|
|
||||||
("button|form|input|label|select|textarea").split("|")
|
|
||||||
);
|
|
||||||
|
|
||||||
var tableTags = lang.arrayToMap(
|
|
||||||
("table|tbody|td|tfoot|th|tr").split("|")
|
|
||||||
);
|
|
||||||
|
|
||||||
function string(state) {
|
function string(state) {
|
||||||
return [{
|
return [{
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -81,7 +71,7 @@ function multiLineString(quote, state) {
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.tag = function(states, name, nextState) {
|
exports.tag = function(states, name, nextState, tagMap) {
|
||||||
states[name] = [{
|
states[name] = [{
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
|
@ -89,26 +79,10 @@ exports.tag = function(states, name, nextState) {
|
||||||
//token : "meta.tag",
|
//token : "meta.tag",
|
||||||
|
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if ( value==='a' ) {
|
if (tagMap && tagMap[value]) {
|
||||||
return "meta.tag.anchor";
|
return "meta.tag.tag-name" + '.' + tagMap[value];
|
||||||
}
|
} else {
|
||||||
else if ( value==='img' ) {
|
return "meta.tag.tag-name";
|
||||||
return "meta.tag.image";
|
|
||||||
}
|
|
||||||
else if ( value==='script' ) {
|
|
||||||
return "meta.tag.script";
|
|
||||||
}
|
|
||||||
else if ( value==='style' ) {
|
|
||||||
return "meta.tag.style";
|
|
||||||
}
|
|
||||||
else if (formTags.hasOwnProperty(value.toLowerCase())) {
|
|
||||||
return "meta.tag.form";
|
|
||||||
}
|
|
||||||
else if (tableTags.hasOwnProperty(value.toLowerCase())) {
|
|
||||||
return "meta.tag.table";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "meta.tag";
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
this.$deltas = [];
|
this.$deltas = [];
|
||||||
var worker = new WorkerClient(["ace"], "worker-xquery.js", "ace/mode/xquery_worker", "XQueryWorker");
|
var worker = new WorkerClient(["ace"], "ace/mode/xquery_worker", "XQueryWorker");
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
session.getDocument().on('change', function(evt){
|
session.getDocument().on('change', function(evt){
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,10 @@ function GutterHandler(mouseHandler) {
|
||||||
var row = e.getDocumentPosition().row;
|
var row = e.getDocumentPosition().row;
|
||||||
var selection = editor.session.selection;
|
var selection = editor.session.selection;
|
||||||
|
|
||||||
if (e.getShiftKey()) {
|
if (e.getShiftKey())
|
||||||
selection.selectTo(row, 0);
|
selection.selectTo(row, 0);
|
||||||
} else {
|
else
|
||||||
selection.moveCursorTo(row, 0);
|
mouseHandler.$clickSelection = editor.selection.getLineRange(row);
|
||||||
selection.selectLine();
|
|
||||||
mouseHandler.$clickSelection = selection.getRange();
|
|
||||||
}
|
|
||||||
|
|
||||||
mouseHandler.captureMouse(e, "selectByLines");
|
mouseHandler.captureMouse(e, "selectByLines");
|
||||||
return e.preventDefault();
|
return e.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -163,10 +163,12 @@ function DefaultHandlers(mouseHandler) {
|
||||||
|
|
||||||
if (cmpStart == -1 && cmpEnd <= 0) {
|
if (cmpStart == -1 && cmpEnd <= 0) {
|
||||||
anchor = this.$clickSelection.end;
|
anchor = this.$clickSelection.end;
|
||||||
cursor = range.start;
|
if (range.end.row != cursor.row || range.end.column != cursor.column)
|
||||||
|
cursor = range.start;
|
||||||
} else if (cmpEnd == 1 && cmpStart >= 0) {
|
} else if (cmpEnd == 1 && cmpStart >= 0) {
|
||||||
anchor = this.$clickSelection.start;
|
anchor = this.$clickSelection.start;
|
||||||
cursor = range.end;
|
if (range.start.row != cursor.row || range.start.column != cursor.column)
|
||||||
|
cursor = range.end;
|
||||||
} else if (cmpStart == -1 && cmpEnd == 1) {
|
} else if (cmpStart == -1 && cmpEnd == 1) {
|
||||||
cursor = range.end;
|
cursor = range.end;
|
||||||
anchor = range.start;
|
anchor = range.start;
|
||||||
|
|
@ -296,10 +298,7 @@ function DefaultHandlers(mouseHandler) {
|
||||||
var editor = this.editor;
|
var editor = this.editor;
|
||||||
|
|
||||||
this.setState("selectByLines");
|
this.setState("selectByLines");
|
||||||
|
this.$clickSelection = editor.selection.getLineRange(pos.row);
|
||||||
editor.moveCursorToPosition(pos);
|
|
||||||
editor.selection.selectLine();
|
|
||||||
this.$clickSelection = editor.getSelectionRange();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onQuadClick = function(ev) {
|
this.onQuadClick = function(ev) {
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,17 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var globalRequire = require;
|
var globalRequire = typeof require != "undefined" && require;
|
||||||
|
|
||||||
define(function (require, exports, module) {
|
define(function (require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.load = function (name, req, onLoad, config) {
|
exports.load = function (name, req, onLoad, config) {
|
||||||
if (req.isBrowser)
|
//Using special require.nodeRequire, something added by r.js.
|
||||||
require("ace/lib/net").get(req.toUrl(name), onLoad);
|
if (globalRequire && globalRequire.nodeRequire)
|
||||||
else
|
|
||||||
//Using special require.nodeRequire, something added by r.js.
|
|
||||||
onLoad(globalRequire.nodeRequire('fs').readFileSync(req.toUrl(name), 'utf8'));
|
onLoad(globalRequire.nodeRequire('fs').readFileSync(req.toUrl(name), 'utf8'));
|
||||||
|
else
|
||||||
|
require("ace/lib/net").get(req.toUrl(name), onLoad);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ var testNames = [
|
||||||
"ace/mode/folding/html_test",
|
"ace/mode/folding/html_test",
|
||||||
"ace/mode/folding/pythonic_test",
|
"ace/mode/folding/pythonic_test",
|
||||||
"ace/mode/folding/xml_test",
|
"ace/mode/folding/xml_test",
|
||||||
|
"ace/mode/folding/coffee_test",
|
||||||
"ace/multi_select_test",
|
"ace/multi_select_test",
|
||||||
"ace/range_test",
|
"ace/range_test",
|
||||||
"ace/range_list_test",
|
"ace/range_list_test",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-chrome .ace_gutter {
|
.ace-chrome .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #ebebeb;
|
||||||
color: #333;
|
color: #333;
|
||||||
overflow : hidden;
|
overflow : hidden;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-clouds .ace_gutter {
|
.ace-clouds .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #ebebeb;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-clouds-midnight .ace_gutter {
|
.ace-clouds-midnight .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #232323;
|
||||||
color: #333;
|
color: #929292;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-clouds-midnight .ace_print_margin {
|
.ace-clouds-midnight .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #232323;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-clouds-midnight .ace_scroller {
|
.ace-clouds-midnight .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-clouds-midnight .ace_gutter_active_line {
|
.ace-clouds-midnight .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: rgba(215, 215, 215, 0.031);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-clouds-midnight .ace_marker-layer .ace_selected_word {
|
.ace-clouds-midnight .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-cobalt .ace_gutter {
|
.ace-cobalt .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #011e3a;
|
||||||
color: #333;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-cobalt .ace_print_margin {
|
.ace-cobalt .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #011e3a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-cobalt .ace_scroller {
|
.ace-cobalt .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-cobalt .ace_gutter_active_line {
|
.ace-cobalt .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color : rgba(0, 0, 0, 0.35);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-cobalt .ace_marker-layer .ace_selected_word {
|
.ace-cobalt .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-crimson-editor .ace_gutter {
|
.ace-crimson-editor .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #ebebeb;
|
||||||
color: #333;
|
color: #333;
|
||||||
overflow : hidden;
|
overflow : hidden;
|
||||||
}
|
}
|
||||||
|
|
@ -133,6 +133,10 @@
|
||||||
background: rgb(232, 242, 254);
|
background: rgb(232, 242, 254);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ace-crimson-editor .ace_gutter_active_line {
|
||||||
|
background-color : #dcdcdc;
|
||||||
|
}
|
||||||
|
|
||||||
.ace-crimson-editor .ace_meta.ace_tag {
|
.ace-crimson-editor .ace_meta.ace_tag {
|
||||||
color:rgb(28, 2, 255);
|
color:rgb(28, 2, 255);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-dawn .ace_gutter {
|
.ace-dawn .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #ebebeb;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-eclipse .ace_gutter {
|
.ace-eclipse .ace_gutter {
|
||||||
background: rgb(227, 227, 227);
|
background: #ebebeb;
|
||||||
border-right: 1px solid rgb(159, 159, 159);
|
border-right: 1px solid rgb(159, 159, 159);
|
||||||
color: rgb(136, 136, 136);
|
color: rgb(136, 136, 136);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-eclipse .ace_print_margin {
|
.ace-eclipse .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #b1b4ba;
|
background: #ebebeb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-eclipse .ace_fold {
|
.ace-eclipse .ace_fold {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,15 @@
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_gutter {
|
||||||
|
background: #e8e8e8;
|
||||||
|
color: #AAA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_scroller {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.ace-github .ace_keyword {
|
.ace-github .ace_keyword {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
@ -29,6 +38,14 @@
|
||||||
color: #099;
|
color: #099;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_constant.ace_buildin {
|
||||||
|
color: #0086B3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_support.ace_function {
|
||||||
|
color: #0086B3;
|
||||||
|
}
|
||||||
|
|
||||||
.ace-github .ace_comment {
|
.ace-github .ace_comment {
|
||||||
color: #998;
|
color: #998;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
|
@ -38,12 +55,11 @@
|
||||||
color: #0086B3;
|
color: #0086B3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-github .ace_paren.ace_lparen,
|
.ace-github .ace_paren {
|
||||||
.ace-github .ace_paren.ace_rparen {
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-github .ace_constant.ace_language.ace_boolean {
|
.ace-github .ace_boolean {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,6 +88,9 @@
|
||||||
border-bottom: 1px solid black;
|
border-bottom: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_marker-layer .ace_active_line {
|
||||||
|
background: rgb(255, 255, 204);
|
||||||
|
}
|
||||||
.ace-github .ace_marker-layer .ace_selection {
|
.ace-github .ace_marker-layer .ace_selection {
|
||||||
background: rgb(181, 213, 255);
|
background: rgb(181, 213, 255);
|
||||||
}
|
}
|
||||||
|
|
@ -79,3 +98,36 @@
|
||||||
box-shadow: 0 0 3px 0px white;
|
box-shadow: 0 0 3px 0px white;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
/* bold keywords cause cursor issues for some fonts */
|
||||||
|
/* this disables bold style for editor and keeps for static highlighter */
|
||||||
|
.ace-github.ace_editor .ace_line > span {
|
||||||
|
font-weight: normal !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_marker-layer .ace_step {
|
||||||
|
background: rgb(252, 255, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_marker-layer .ace_stack {
|
||||||
|
background: rgb(164, 229, 101);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_marker-layer .ace_bracket {
|
||||||
|
margin: -1px 0 0 -1px;
|
||||||
|
border: 1px solid rgb(192, 192, 192);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_gutter_active_line{
|
||||||
|
background-color : rgba(0, 0, 0, 0.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_marker-layer .ace_selected_word {
|
||||||
|
background: rgb(250, 250, 255);
|
||||||
|
border: 1px solid rgb(200, 200, 250);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-github .ace_print_margin {
|
||||||
|
width: 1px;
|
||||||
|
background: #e8e8e8;
|
||||||
|
}
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
exports.isDark = true;
|
exports.isDark = false;
|
||||||
exports.cssClass = "ace-github";
|
exports.cssClass = "ace-github";
|
||||||
exports.cssText = require('ace/requirejs/text!./github.css');
|
exports.cssText = require('ace/requirejs/text!./github.css');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-idle-fingers .ace_gutter {
|
.ace-idle-fingers .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #3b3b3b;
|
||||||
color: #333;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-idle-fingers .ace_print_margin {
|
.ace-idle-fingers .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #3b3b3b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-idle-fingers .ace_scroller {
|
.ace-idle-fingers .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-idle-fingers .ace_gutter_active_line {
|
.ace-idle-fingers .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: #353637;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-idle-fingers .ace_marker-layer .ace_selected_word {
|
.ace-idle-fingers .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-kr-theme .ace_gutter {
|
.ace-kr-theme .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #1c1917;
|
||||||
color: #333;
|
color: #FCFFE0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-kr-theme .ace_print_margin {
|
.ace-kr-theme .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #1c1917;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-kr-theme .ace_scroller {
|
.ace-kr-theme .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-kr-theme .ace_gutter_active_line {
|
.ace-kr-theme .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color : #38403D;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-kr-theme .ace_marker-layer .ace_selected_word {
|
.ace-kr-theme .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore .ace_gutter {
|
.ace-merbivore .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #202020;
|
||||||
color: #333;
|
color: #E6E1DC;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore .ace_print_margin {
|
.ace-merbivore .ace_print_margin {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore .ace_gutter_active_line {
|
.ace-merbivore .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color : #333435;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore .ace_marker-layer .ace_selected_word {
|
.ace-merbivore .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore-soft .ace_gutter {
|
.ace-merbivore-soft .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #262424;
|
||||||
color: #333;
|
color: #E6E1DC;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore-soft .ace_print_margin {
|
.ace-merbivore-soft .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #262424;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore-soft .ace_scroller {
|
.ace-merbivore-soft .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore-soft .ace_gutter_active_line {
|
.ace-merbivore-soft .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: #333435;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-merbivore-soft .ace_marker-layer .ace_selected_word {
|
.ace-merbivore-soft .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-mono-industrial .ace_gutter {
|
.ace-mono-industrial .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #1d2521;
|
||||||
color: #333;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-mono-industrial .ace_print_margin {
|
.ace-mono-industrial .ace_print_margin {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-mono-industrial .ace_gutter_active_line {
|
.ace-mono-industrial .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: rgba(12, 13, 12, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-mono-industrial .ace_marker-layer .ace_selected_word {
|
.ace-mono-industrial .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-monokai .ace_gutter {
|
.ace-monokai .ace_gutter {
|
||||||
background: #292a24;
|
background: #2f3129;
|
||||||
color: #f1f1f1;
|
color: #f1f1f1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-pastel-on-dark .ace_gutter {
|
.ace-pastel-on-dark .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #353030;
|
||||||
color: #333;
|
color: #8F938F;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-pastel-on-dark .ace_print_margin {
|
.ace-pastel-on-dark .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #353030;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-pastel-on-dark .ace_scroller {
|
.ace-pastel-on-dark .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-pastel-on-dark .ace_gutter_active_line {
|
.ace-pastel-on-dark .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: rgba(255, 255, 255, 0.031);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-pastel-on-dark .ace_marker-layer .ace_selected_word {
|
.ace-pastel-on-dark .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-solarized-dark .ace_gutter {
|
.ace-solarized-dark .ace_gutter {
|
||||||
background: #09222b;
|
background: #01313f;
|
||||||
color: #d0edf7;
|
color: #d0edf7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-solarized-light .ace_gutter {
|
.ace-solarized-light .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #fbf1d3;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tm .ace_gutter {
|
.ace-tm .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #f0f0f0;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,7 +146,8 @@
|
||||||
.ace-tm .ace_marker-layer .ace_active_line {
|
.ace-tm .ace_marker-layer .ace_active_line {
|
||||||
background: rgba(0, 0, 0, 0.07);
|
background: rgba(0, 0, 0, 0.07);
|
||||||
}
|
}
|
||||||
.ace-tm .ace_gutter_active_line{
|
|
||||||
|
.ace-tm .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color : #dcdcdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow .ace_gutter {
|
.ace-tomorrow .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #f6f6f6;
|
||||||
color: #333;
|
color: #4D4D4C;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow .ace_print_margin {
|
.ace-tomorrow .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow .ace_scroller {
|
.ace-tomorrow .ace_scroller {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night .ace_gutter {
|
.ace-tomorrow-night .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #25282c;
|
||||||
color: #333;
|
color: #C5C8C6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night .ace_print_margin {
|
.ace-tomorrow-night .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #25282c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night .ace_scroller {
|
.ace-tomorrow-night .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night .ace_gutter_active_line {
|
.ace-tomorrow-night .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: #282A2E;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night .ace_marker-layer .ace_selected_word {
|
.ace-tomorrow-night .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-blue .ace_gutter {
|
.ace-tomorrow-night-blue .ace_gutter {
|
||||||
background: #022346;
|
background: #00204b;
|
||||||
color: #7388b5;
|
color: #7388b5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-blue .ace_print_margin {
|
.ace-tomorrow-night-blue .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #00204b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-blue .ace_scroller {
|
.ace-tomorrow-night-blue .ace_scroller {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_gutter {
|
.ace-tomorrow-night-bright .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #1a1a1a;
|
||||||
color: #333;
|
color: #DEDEDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_print_margin {
|
.ace-tomorrow-night-bright .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #1a1a1a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_scroller {
|
.ace-tomorrow-night-bright .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_gutter_active_line {
|
.ace-tomorrow-night-bright .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: #2A2A2A;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-bright .ace_marker-layer .ace_selected_word {
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-eighties .ace_gutter {
|
.ace-tomorrow-night-eighties .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #272727;
|
||||||
color: #333;
|
color: #CCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-eighties .ace_print_margin {
|
.ace-tomorrow-night-eighties .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #272727;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-eighties .ace_scroller {
|
.ace-tomorrow-night-eighties .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-eighties .ace_gutter_active_line {
|
.ace-tomorrow-night-eighties .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: #393939;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tomorrow-night-eighties .ace_marker-layer .ace_selected_word {
|
.ace-tomorrow-night-eighties .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-twilight .ace_gutter {
|
.ace-twilight .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #232323;
|
||||||
color: #333;
|
color: #F8F8F8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-twilight .ace_print_margin {
|
.ace-twilight .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #232323;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-twilight .ace_scroller {
|
.ace-twilight .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-twilight .ace_gutter_active_line {
|
.ace-twilight .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: rgba(255, 255, 255, 0.031);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-twilight .ace_marker-layer .ace_selected_word {
|
.ace-twilight .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-vibrant-ink .ace_gutter {
|
.ace-vibrant-ink .ace_gutter {
|
||||||
background: #e8e8e8;
|
background: #1a1a1a;
|
||||||
color: #333;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-vibrant-ink .ace_print_margin {
|
.ace-vibrant-ink .ace_print_margin {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: #e8e8e8;
|
background: #1a1a1a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-vibrant-ink .ace_scroller {
|
.ace-vibrant-ink .ace_scroller {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-vibrant-ink .ace_gutter_active_line {
|
.ace-vibrant-ink .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-vibrant-ink .ace_marker-layer .ace_selected_word {
|
.ace-vibrant-ink .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
||||||
this.scroller.style.left = gutterWidth + "px";
|
this.scroller.style.left = gutterWidth + "px";
|
||||||
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth());
|
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth());
|
||||||
//this.scroller.style.width = size.scrollerWidth + "px";
|
this.scroller.style.right = this.scrollBar.getWidth() + "px";
|
||||||
|
|
||||||
if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
|
if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
|
||||||
changes = changes | this.CHANGE_FULL;
|
changes = changes | this.CHANGE_FULL;
|
||||||
|
|
@ -1288,9 +1288,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
if (!config.get("packaged"))
|
if (!config.get("packaged"))
|
||||||
return callback();
|
return callback();
|
||||||
|
|
||||||
var base = name.split("/").pop();
|
net.loadScript(config.moduleUrl(name, "theme"), callback);
|
||||||
var filename = config.get("themePath") + "/theme-" + base + config.get("suffix");
|
|
||||||
net.loadScript(filename, callback);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@ var oop = require("../lib/oop");
|
||||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||||
var config = require("../config");
|
var config = require("../config");
|
||||||
|
|
||||||
var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
|
var WorkerClient = function(topLevelNamespaces, mod, classname) {
|
||||||
|
|
||||||
this.changeListener = this.changeListener.bind(this);
|
this.changeListener = this.changeListener.bind(this);
|
||||||
|
|
||||||
if (config.get("packaged")) {
|
if (config.get("packaged")) {
|
||||||
this.$worker = new Worker(config.get("workerPath") + "/" + packagedJs);
|
this.$worker = new Worker(config.moduleUrl(mod, "worker"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var workerUrl;
|
var workerUrl;
|
||||||
|
|
@ -66,7 +66,7 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
|
||||||
var tlns = {};
|
var tlns = {};
|
||||||
for (var i=0; i<topLevelNamespaces.length; i++) {
|
for (var i=0; i<topLevelNamespaces.length; i++) {
|
||||||
var ns = topLevelNamespaces[i];
|
var ns = topLevelNamespaces[i];
|
||||||
var path = this.$normalizePath(require.toUrl(ns, null, "_").replace(/.js$/, ""));
|
var path = this.$normalizePath(require.toUrl(ns, null, "_").replace(/.js(\?.*)?$/, ""));
|
||||||
|
|
||||||
tlns[ns] = path;
|
tlns[ns] = path;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
static.js
18
static.js
|
|
@ -1,18 +1,22 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
var http = require("http"),
|
var http = require("http")
|
||||||
url = require("url"),
|
, path = require("path")
|
||||||
path = require("path"),
|
, mime = require("mime")
|
||||||
fs = require("fs"),
|
, url = require("url")
|
||||||
mime = require("mime"),
|
, fs = require("fs")
|
||||||
port = process.env.PORT || 8888;
|
, port = process.env.PORT || 8888;
|
||||||
|
|
||||||
|
// compatibility with node 0.6
|
||||||
|
if (!fs.exists)
|
||||||
|
fs.exists = path.exists;
|
||||||
|
|
||||||
http.createServer(function(request, response) {
|
http.createServer(function(request, response) {
|
||||||
|
|
||||||
var uri = url.parse(request.url).pathname
|
var uri = url.parse(request.url).pathname
|
||||||
, filename = path.join(process.cwd(), uri);
|
, filename = path.join(process.cwd(), uri);
|
||||||
|
|
||||||
path.exists(filename, function(exists) {
|
fs.exists(filename, function(exists) {
|
||||||
if(!exists) {
|
if(!exists) {
|
||||||
response.writeHead(404, {"Content-Type": "text/plain"});
|
response.writeHead(404, {"Content-Type": "text/plain"});
|
||||||
response.write("404 Not Found\n");
|
response.write("404 Not Found\n");
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.%cssClass% .ace_gutter_active_line {
|
.%cssClass% .ace_gutter_active_line {
|
||||||
background-color : #dcdcdc;
|
background-color: %active_line%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.%cssClass% .ace_marker-layer .ace_selected_word {
|
.%cssClass% .ace_marker-layer .ace_selected_word {
|
||||||
|
|
|
||||||
184
tool/mode_tool.html
Normal file
184
tool/mode_tool.html
Normal file
|
|
@ -0,0 +1,184 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<title>Editor</title>
|
||||||
|
<style type="text/css" media="screen">
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#editor {
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="toolbar"></div>
|
||||||
|
<pre id="editor"></pre>
|
||||||
|
|
||||||
|
<script src="../build/src/ace.js" type="text/javascript"></script>
|
||||||
|
<script src="../build/kitchen-sink/demo.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var $ = document.getElementById.bind(document);
|
||||||
|
function bindDropdown(el, callback) {
|
||||||
|
var onChange = function() {
|
||||||
|
callback(el.value);
|
||||||
|
};
|
||||||
|
el.onchange = onChange;
|
||||||
|
onChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillDropdown(list, el) {
|
||||||
|
list.forEach(function(item) {
|
||||||
|
var option = document.createElement("option");
|
||||||
|
option.setAttribute("value", item.name);
|
||||||
|
option.innerHTML = item.desc;
|
||||||
|
el.appendChild(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/************** modes ***********************/
|
||||||
|
var modes = [];
|
||||||
|
function getModeFromPath(path) {
|
||||||
|
var mode = modesByName.text;
|
||||||
|
for (var i = 0; i < modes.length; i++) {
|
||||||
|
if (modes[i].supportsFile(path)) {
|
||||||
|
mode = modes[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
var Mode = function(name, desc, extensions) {
|
||||||
|
this.name = name;
|
||||||
|
this.desc = desc;
|
||||||
|
this.mode = "ace/mode/" + name;
|
||||||
|
this.extRe = new RegExp("^.*\\.(" + extensions + ")$", "g");
|
||||||
|
};
|
||||||
|
|
||||||
|
Mode.prototype.supportsFile = function(filename) {
|
||||||
|
return filename.match(this.extRe);
|
||||||
|
};
|
||||||
|
|
||||||
|
var modesByName = {
|
||||||
|
c9search: ["C9Search" , "c9search_results"],
|
||||||
|
coffee: ["CoffeeScript" , "coffee|^Cakefile"],
|
||||||
|
coldfusion: ["ColdFusion" , "cfm"],
|
||||||
|
csharp: ["C#" , "cs"],
|
||||||
|
css: ["CSS" , "css"],
|
||||||
|
diff: ["Diff" , "diff|patch"],
|
||||||
|
golang: ["Go" , "go"],
|
||||||
|
groovy: ["Groovy" , "groovy"],
|
||||||
|
haxe: ["haXe" , "hx"],
|
||||||
|
html: ["HTML" , "htm|html|xhtml"],
|
||||||
|
c_cpp: ["C/C++" , "c|cc|cpp|cxx|h|hh|hpp"],
|
||||||
|
clojure: ["Clojure" , "clj"],
|
||||||
|
java: ["Java" , "java"],
|
||||||
|
javascript: ["JavaScript" , "js"],
|
||||||
|
json: ["JSON" , "json"],
|
||||||
|
jsx: ["JSX" , "jsx"],
|
||||||
|
latex: ["LaTeX" , "latex|tex|ltx|bib"],
|
||||||
|
less: ["LESS" , "less"],
|
||||||
|
liquid: ["Liquid" , "liquid"],
|
||||||
|
lua: ["Lua" , "lua"],
|
||||||
|
luapage: ["LuaPage" , "lp"], // http://keplerproject.github.com/cgilua/manual.html#templates
|
||||||
|
markdown: ["Markdown" , "md|markdown"],
|
||||||
|
ocaml: ["OCaml" , "ml|mli"],
|
||||||
|
perl: ["Perl" , "pl|pm"],
|
||||||
|
pgsql: ["pgSQL" , "pgsql"],
|
||||||
|
php: ["PHP" , "php|phtml"],
|
||||||
|
powershell: ["Powershell" , "ps1"],
|
||||||
|
python: ["Python" , "py"],
|
||||||
|
ruby: ["Ruby" , "ru|gemspec|rake|rb"],
|
||||||
|
scad: ["OpenSCAD" , "scad"],
|
||||||
|
scala: ["Scala" , "scala"],
|
||||||
|
scss: ["SCSS" , "scss|sass"],
|
||||||
|
sh: ["SH" , "sh|bash|bat"],
|
||||||
|
sql: ["SQL" , "sql"],
|
||||||
|
svg: ["SVG" , "svg"],
|
||||||
|
text: ["Text" , "txt"],
|
||||||
|
textile: ["Textile" , "textile"],
|
||||||
|
xml: ["XML" , "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
||||||
|
xquery: ["XQuery" , "xq"],
|
||||||
|
yaml: ["YAML" , "yaml"]
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var name in modesByName) {
|
||||||
|
var mode = modesByName[name];
|
||||||
|
mode = new Mode(name, mode[0], mode[1])
|
||||||
|
modesByName[name] = mode;
|
||||||
|
modes.push(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var container = document.getElementById("editor");
|
||||||
|
container.style.position = "absolute";
|
||||||
|
// Splitting.
|
||||||
|
var Split = require("ace/split").Split;
|
||||||
|
var split = new Split(container, null, 1);
|
||||||
|
split.setOrientation(split.BESIDE);
|
||||||
|
split.setSplits(2);
|
||||||
|
|
||||||
|
var editor1 = split.getEditor(0);
|
||||||
|
var editor2 = split.getEditor(1);
|
||||||
|
|
||||||
|
var toolbar = $("toolbar");
|
||||||
|
var modeEl = document.createElement("select");
|
||||||
|
fillDropdown(modes, modeEl);
|
||||||
|
|
||||||
|
bindDropdown(modeEl, function(value) {
|
||||||
|
editor1.session.setMode((modesByName[value] || modesByName.text).mode);
|
||||||
|
});
|
||||||
|
toolbar.appendChild(modeEl);
|
||||||
|
var button = document.createElement("input");
|
||||||
|
button.setAttribute("type", "button");
|
||||||
|
button.value = "generate test";
|
||||||
|
toolbar.appendChild(button)
|
||||||
|
|
||||||
|
function onResize() {
|
||||||
|
var top = toolbar.clientHeight;
|
||||||
|
var width = document.documentElement.clientWidth;
|
||||||
|
container.style.top = top + "px";
|
||||||
|
container.style.width = width + "px";
|
||||||
|
container.style.height = document.documentElement.clientHeight - top + "px";
|
||||||
|
split.resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onresize = onResize;
|
||||||
|
onResize();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
button.onclick = function() {
|
||||||
|
var s = editor1.session
|
||||||
|
tok = s.bgTokenizer
|
||||||
|
var data = []
|
||||||
|
for (var i = 0; i < s.getLength(); i++) {
|
||||||
|
data.push({
|
||||||
|
text: s.getLine(i),
|
||||||
|
state: [tok.getState(i - 1), tok.getState(i)],
|
||||||
|
tokens: tok.getTokens(i)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
data = JSON.stringify(data, null, 4);
|
||||||
|
data = data.replace(/(\n\s*)"(\w+)":/g, "$1$2:");
|
||||||
|
editor2.insert(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue