Merge remote-tracking branch 'remotes/origin/master' into v-1.2
Conflicts: lib/ace/anchor.js lib/ace/keyboard/vim/maps/operators.js
This commit is contained in:
commit
1f7582b5a6
267 changed files with 107605 additions and 62551 deletions
|
|
@ -1,3 +1,13 @@
|
|||
2014.07.01 Version 1.1.4
|
||||
|
||||
* New Features
|
||||
- Highlight matching tags (Adam Jimenez)
|
||||
- Improved jump to matching command (Adam Jimenez)
|
||||
|
||||
* new language modes
|
||||
- AppleScript (Yaogang Lian)
|
||||
- Vala
|
||||
|
||||
2014.03.08 Version 1.1.3
|
||||
|
||||
* New Features
|
||||
|
|
|
|||
1
Makefile
1
Makefile
|
|
@ -13,7 +13,6 @@ pre_build:
|
|||
build: pre_build
|
||||
./Makefile.dryice.js normal
|
||||
./Makefile.dryice.js demo
|
||||
./Makefile.dryice.js bm
|
||||
|
||||
# Minimal build: call Makefile.dryice.js only if our sources changed
|
||||
basic: build/src/ace.js
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -20,7 +20,7 @@ function foo() {
|
|||
var bar = true;
|
||||
}</textarea><br>
|
||||
SourceUrl: <br>
|
||||
<input id="srcURL" style="width:300px" value="http://ajaxorg.github.com/ace-builds/textarea/src/"></input><br>
|
||||
<input id="srcURL" style="width:300px" value="http://ajaxorg.github.com/ace-builds/src-noconflict"></input><br>
|
||||
<button id="buBuild">Build Link</button> <br> <a href="#"></a>
|
||||
<a href="https://github.com/ajaxorg/ace/">
|
||||
<div class="fork_on_github" ></div>
|
||||
|
|
@ -49,63 +49,60 @@ function foo() {
|
|||
|
||||
<script>
|
||||
|
||||
function inject(callback) {
|
||||
var baseUrl = "src/";
|
||||
function inject(options, callback) {
|
||||
var baseUrl = options.baseUrl || "../../src-noconflict";
|
||||
|
||||
var load = window.__ace_loader__ = function(path, module, callback) {
|
||||
var load = function(path, callback) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
s.src = baseUrl + path;
|
||||
|
||||
s.src = baseUrl + "/" + path;
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = function() {
|
||||
window.__ace_shadowed__.require([module], callback);
|
||||
|
||||
s.onload = s.onreadystatechange = function(_, isAbort) {
|
||||
if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
|
||||
s = s.onload = s.onreadystatechange = null;
|
||||
if (!isAbort)
|
||||
callback();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
load('ace-bookmarklet.js', "ace/ext/textarea", function() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
|
||||
ace.options.mode = "javascript";
|
||||
var Event = ace.require("ace/lib/event");
|
||||
var areas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
Event.addListener(areas[i], "click", function(e) {
|
||||
if (e.detail == 3) {
|
||||
ace.transformTextarea(e.target, load);
|
||||
}
|
||||
});
|
||||
}
|
||||
callback && callback();
|
||||
load("ace.js", function() {
|
||||
ace.config.loadModule("ace/ext/textarea", function() {
|
||||
var event = ace.require("ace/lib/event");
|
||||
var areas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
event.addListener(areas[i], "click", function(e) {
|
||||
if (e.detail == 3) {
|
||||
ace.transformTextarea(e.target, options.ace);
|
||||
}
|
||||
});
|
||||
}
|
||||
callback && callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Call the inject function to load the ace files.
|
||||
var textAce;
|
||||
inject(function () {
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
var ace = window.__ace_shadowed__;
|
||||
inject({}, function () {
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
var t = document.querySelector("textarea");
|
||||
textAce = ace.transformTextarea(t, window.__ace_loader__);
|
||||
textAce = ace.require("ace/ext/textarea").transformTextarea(t);
|
||||
setTimeout(function(){textAce.setDisplaySettings(true)});
|
||||
});
|
||||
|
||||
|
||||
document.getElementById("buBuild").onclick = function() {
|
||||
var injectSrc = inject.toString().split("\n").join("");
|
||||
injectSrc = injectSrc.replace('baseUrl = "src/"', 'baseUrl="' + document.getElementById("srcURL").value + '"');
|
||||
|
||||
var aceOptions = textAce.getOptions();
|
||||
var opt = [];
|
||||
for (var option in aceOptions) {
|
||||
opt.push(option + ":'" + aceOptions[option] + "'");
|
||||
}
|
||||
injectSrc = injectSrc.replace('ace.options.mode = "javascript"', 'ace.options = { ' + opt.join(",") + ' }');
|
||||
injectSrc = injectSrc.replace(/\s+/g, " ");
|
||||
|
||||
var options = textAce.getOptions();
|
||||
options.baseUrl = document.getElementById("srcURL").value;
|
||||
|
||||
var a = document.querySelector("a");
|
||||
a.href = "javascript:(" + injectSrc + ")()";
|
||||
a.href = "javascript:(" + injectSrc + ")(" + JSON.stringify(options) + ")";
|
||||
a.innerHTML = "Ace Bookmarklet Link";
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,8 @@
|
|||
// enable autocompletion and snippets
|
||||
editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true
|
||||
enableSnippets: true,
|
||||
enableLiveAutocompletion: false
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,29 +20,41 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="editor">autoresizing editor</pre>
|
||||
<pre id="editor1">autoresizing editor</pre>
|
||||
<div class="scrollmargin"></div>
|
||||
<pre id="editor2">minHeight = 2 lines</pre>
|
||||
<div class="scrollmargin"></div>
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src/ace.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace"], function(ace) {
|
||||
|
||||
// create first editor
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
editor.setAutoScrollEditorIntoView();
|
||||
editor.setOption("maxLines", 100);
|
||||
|
||||
var editor2 = ace.edit("editor2");
|
||||
editor2.setTheme("ace/theme/tomorrow_night_blue");
|
||||
editor2.session.setMode("ace/mode/html");
|
||||
editor2.setAutoScrollEditorIntoView();
|
||||
editor2.setOption("maxLines", 30);
|
||||
editor2.setOption("minLines", 2);
|
||||
var editor1 = ace.edit("editor1");
|
||||
editor1.setTheme("ace/theme/tomorrow_night_eighties");
|
||||
editor1.session.setMode("ace/mode/html");
|
||||
editor1.setAutoScrollEditorIntoView(true);
|
||||
editor1.setOption("maxLines", 30);
|
||||
|
||||
var editor2 = ace.edit("editor2");
|
||||
editor2.setTheme("ace/theme/tomorrow_night_blue");
|
||||
editor2.session.setMode("ace/mode/html");
|
||||
editor2.setAutoScrollEditorIntoView(true);
|
||||
editor2.setOption("maxLines", 30);
|
||||
editor2.setOption("minLines", 2);
|
||||
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
editor.setAutoScrollEditorIntoView(true);
|
||||
editor.setOption("maxLines", 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -22,19 +22,20 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<!-- load ace -->
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<!-- load ace emmet extension -->
|
||||
<script src="../build/src-noconflict/ext-emmet.js"></script>
|
||||
<!-- load core emmet files -->
|
||||
<script src="http://nightwing.github.io/emmet-core/emmet.js"></script>
|
||||
<!-- load emmet code and snippets compiled for browser -->
|
||||
<script src="https://nightwing.github.io/emmet-core/emmet.js"></script>
|
||||
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// trigger extension
|
||||
ace.require("ace/ext/emmet");
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/emmet"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
// enable emmet on the current editor
|
||||
editor.setOption("enableEmmet", true);
|
||||
editor.setOption("enableEmmet", true);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>ACE Editor StatusBar Demo</title>
|
||||
<style type="text/css" media="screen">
|
||||
/*!important without this top: 0; bottom: 0 doesn't work */
|
||||
/*!important without this top: 0; bottom: 0 doesn't work on old ie */
|
||||
body, html {
|
||||
position: absolute;
|
||||
top: 0px; bottom: 0; left: 0; right: 0;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
require(["ace/ace"], function(ace) {
|
||||
var editor = ace.edit("editor")
|
||||
editor.setTheme("ace/theme/twilight")
|
||||
editor.session.setMode("ace/mode/html")
|
||||
|
|
@ -39,6 +42,8 @@
|
|||
})
|
||||
}
|
||||
})
|
||||
editor.execCommand("showKeyboardShortcuts")
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
|
|
@ -184,21 +184,21 @@ env.editor.commands.addCommands([{
|
|||
}
|
||||
}, {
|
||||
name: "increaseFontSize",
|
||||
bindKey: "Ctrl-+",
|
||||
bindKey: "Ctrl-=|Ctrl-+",
|
||||
exec: function(editor) {
|
||||
var size = parseInt(editor.getFontSize(), 10) || 12;
|
||||
editor.setFontSize(size + 1);
|
||||
}
|
||||
}, {
|
||||
name: "decreaseFontSize",
|
||||
bindKey: "Ctrl+-",
|
||||
bindKey: "Ctrl+-|Ctrl-_",
|
||||
exec: function(editor) {
|
||||
var size = parseInt(editor.getFontSize(), 10) || 12;
|
||||
editor.setFontSize(Math.max(size - 1 || 1));
|
||||
}
|
||||
}, {
|
||||
name: "resetFontSize",
|
||||
bindKey: "Ctrl+0",
|
||||
bindKey: "Ctrl+0|Ctrl-Numpad0",
|
||||
exec: function(editor) {
|
||||
editor.setFontSize(12);
|
||||
}
|
||||
|
|
@ -548,7 +548,7 @@ new StatusBar(env.editor, cmdLine.container);
|
|||
|
||||
|
||||
var Emmet = require("ace/ext/emmet");
|
||||
net.loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() {
|
||||
net.loadScript("https://nightwing.github.io/emmet-core/emmet.js", function() {
|
||||
Emmet.setCore(window.emmet);
|
||||
env.editor.setOption("enableEmmet", true);
|
||||
});
|
||||
|
|
@ -592,7 +592,7 @@ env.editSnippets = function() {
|
|||
require("ace/ext/language_tools");
|
||||
env.editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableLiveAutocomplete: true,
|
||||
enableLiveAutocompletion: true,
|
||||
enableSnippets: true
|
||||
});
|
||||
|
||||
|
|
|
|||
53
demo/kitchen-sink/docs/Dockerfile
Normal file
53
demo/kitchen-sink/docs/Dockerfile
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#
|
||||
# example Dockerfile for http://docs.docker.io/en/latest/examples/postgresql_service/
|
||||
#
|
||||
|
||||
FROM ubuntu
|
||||
MAINTAINER SvenDowideit@docker.com
|
||||
|
||||
# Add the PostgreSQL PGP key to verify their Debian packages.
|
||||
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||
|
||||
# Add PostgreSQL's repository. It contains the most recent stable release
|
||||
# of PostgreSQL, ``9.3``.
|
||||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||
|
||||
# Update the Ubuntu and PostgreSQL repository indexes
|
||||
RUN apt-get update
|
||||
|
||||
# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3
|
||||
# There are some warnings (in red) that show up during the build. You can hide
|
||||
# them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get -y -q install python-software-properties software-properties-common
|
||||
RUN apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
|
||||
|
||||
# Note: The official Debian and Ubuntu images automatically ``apt-get clean``
|
||||
# after each ``apt-get``
|
||||
|
||||
# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed``
|
||||
USER postgres
|
||||
|
||||
# Create a PostgreSQL role named ``docker`` with ``docker`` as the password and
|
||||
# then create a database `docker` owned by the ``docker`` role.
|
||||
# Note: here we use ``&&\`` to run commands one after the other - the ``\``
|
||||
# allows the RUN command to span multiple lines.
|
||||
RUN /etc/init.d/postgresql start &&\
|
||||
psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\
|
||||
createdb -O docker docker
|
||||
|
||||
# Adjust PostgreSQL configuration so that remote connections to the
|
||||
# database are possible.
|
||||
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
|
||||
|
||||
# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
|
||||
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf
|
||||
|
||||
# Expose the PostgreSQL port
|
||||
EXPOSE 5432
|
||||
|
||||
# Add VOLUMEs to allow backup of config, logs and databases
|
||||
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
|
||||
|
||||
# Set the default command to run when starting the container
|
||||
CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"]
|
||||
|
|
@ -2,7 +2,7 @@ for op = (:+, :*, :&, :|, :$)
|
|||
@eval ($op)(a,b,c) = ($op)(($op)(a,b),c)
|
||||
end
|
||||
|
||||
|
||||
v = α';
|
||||
function g(x,y)
|
||||
return x * y
|
||||
x + y
|
||||
|
|
|
|||
21
demo/kitchen-sink/docs/vala.vala
Normal file
21
demo/kitchen-sink/docs/vala.vala
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using Gtk;
|
||||
|
||||
int main (string[] args) {
|
||||
Gtk.init (ref args);
|
||||
var foo = new MyFoo<string[](), MyBar<string, int>>();
|
||||
|
||||
var window = new Window();
|
||||
window.title = "Hello, World!";
|
||||
window.border_width = 10;
|
||||
window.window_position = WindowPosition.CENTER;
|
||||
window.set_default_size(350, 70);
|
||||
window.destroy.connect(Gtk.main_quit);
|
||||
|
||||
var label = new Label("Hello, World!");
|
||||
|
||||
window.add(label);
|
||||
window.show_all();
|
||||
|
||||
Gtk.main();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license RequireJS 2.1.9+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* @license RequireJS 2.1.11+ Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
|
|
@ -12,7 +12,7 @@ var requirejs, require, define;
|
|||
(function (global) {
|
||||
var req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||
version = '2.1.9+',
|
||||
version = '2.1.11+',
|
||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
|
|
@ -108,7 +108,10 @@ var requirejs, require, define;
|
|||
if (source) {
|
||||
eachProp(source, function (value, prop) {
|
||||
if (force || !hasProp(target, prop)) {
|
||||
if (deepStringMixin && typeof value !== 'string') {
|
||||
if (deepStringMixin && typeof value === 'object' && value &&
|
||||
!isArray(value) && !isFunction(value) &&
|
||||
!(value instanceof RegExp)) {
|
||||
|
||||
if (!target[prop]) {
|
||||
target[prop] = {};
|
||||
}
|
||||
|
|
@ -138,7 +141,7 @@ var requirejs, require, define;
|
|||
throw err;
|
||||
}
|
||||
|
||||
//Allow getting a global that expressed in
|
||||
//Allow getting a global that is expressed in
|
||||
//dot notation, like 'a.b.c'.
|
||||
function getGlobal(value) {
|
||||
if (!value) {
|
||||
|
|
@ -177,7 +180,7 @@ var requirejs, require, define;
|
|||
|
||||
if (typeof requirejs !== 'undefined') {
|
||||
if (isFunction(requirejs)) {
|
||||
//Do not overwrite and existing requirejs instance.
|
||||
//Do not overwrite an existing requirejs instance.
|
||||
return;
|
||||
}
|
||||
cfg = requirejs;
|
||||
|
|
@ -201,6 +204,7 @@ var requirejs, require, define;
|
|||
waitSeconds: 7,
|
||||
baseUrl: './',
|
||||
paths: {},
|
||||
bundles: {},
|
||||
pkgs: {},
|
||||
shim: {},
|
||||
config: {}
|
||||
|
|
@ -214,6 +218,7 @@ var requirejs, require, define;
|
|||
defQueue = [],
|
||||
defined = {},
|
||||
urlFetched = {},
|
||||
bundlesMap = {},
|
||||
requireCounter = 1,
|
||||
unnormalizedCounter = 1;
|
||||
|
||||
|
|
@ -227,8 +232,8 @@ var requirejs, require, define;
|
|||
* @param {Array} ary the array of path segments.
|
||||
*/
|
||||
function trimDots(ary) {
|
||||
var i, part;
|
||||
for (i = 0; ary[i]; i += 1) {
|
||||
var i, part, length = ary.length;
|
||||
for (i = 0; i < length; i++) {
|
||||
part = ary[i];
|
||||
if (part === '.') {
|
||||
ary.splice(i, 1);
|
||||
|
|
@ -261,7 +266,7 @@ var requirejs, require, define;
|
|||
* @returns {String} normalized name
|
||||
*/
|
||||
function normalize(name, baseName, applyMap) {
|
||||
var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
|
||||
var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
|
||||
foundMap, foundI, foundStarMap, starI,
|
||||
baseParts = baseName && baseName.split('/'),
|
||||
normalizedBaseParts = baseParts,
|
||||
|
|
@ -274,29 +279,26 @@ var requirejs, require, define;
|
|||
//otherwise, assume it is a top-level require that will
|
||||
//be relative to baseUrl in the end.
|
||||
if (baseName) {
|
||||
if (getOwn(config.pkgs, baseName)) {
|
||||
//If the baseName is a package name, then just treat it as one
|
||||
//name to concat the name with.
|
||||
normalizedBaseParts = baseParts = [baseName];
|
||||
} else {
|
||||
//Convert baseName to array, and lop off the last part,
|
||||
//so that . matches that 'directory' and not name of the baseName's
|
||||
//module. For instance, baseName of 'one/two/three', maps to
|
||||
//'one/two/three.js', but we want the directory, 'one/two' for
|
||||
//this normalization.
|
||||
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
||||
//Convert baseName to array, and lop off the last part,
|
||||
//so that . matches that 'directory' and not name of the baseName's
|
||||
//module. For instance, baseName of 'one/two/three', maps to
|
||||
//'one/two/three.js', but we want the directory, 'one/two' for
|
||||
//this normalization.
|
||||
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
||||
name = name.split('/');
|
||||
lastIndex = name.length - 1;
|
||||
|
||||
// If wanting node ID compatibility, strip .js from end
|
||||
// of IDs. Have to do this here, and not in nameToUrl
|
||||
// because node allows either .js or non .js to map
|
||||
// to same file.
|
||||
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
||||
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
||||
}
|
||||
|
||||
name = normalizedBaseParts.concat(name.split('/'));
|
||||
name = normalizedBaseParts.concat(name);
|
||||
trimDots(name);
|
||||
|
||||
//Some use of packages may use a . path to reference the
|
||||
//'main' module name, so normalize for that.
|
||||
pkgConfig = getOwn(config.pkgs, (pkgName = name[0]));
|
||||
name = name.join('/');
|
||||
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
|
||||
name = pkgName;
|
||||
}
|
||||
} else if (name.indexOf('./') === 0) {
|
||||
// No baseName, so this is ID is resolved relative
|
||||
// to baseUrl, pull off the leading dot.
|
||||
|
|
@ -308,7 +310,7 @@ var requirejs, require, define;
|
|||
if (applyMap && map && (baseParts || starMap)) {
|
||||
nameParts = name.split('/');
|
||||
|
||||
for (i = nameParts.length; i > 0; i -= 1) {
|
||||
outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
|
||||
nameSegment = nameParts.slice(0, i).join('/');
|
||||
|
||||
if (baseParts) {
|
||||
|
|
@ -325,16 +327,12 @@ var requirejs, require, define;
|
|||
//Match, update name to the new value.
|
||||
foundMap = mapValue;
|
||||
foundI = i;
|
||||
break;
|
||||
break outerLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundMap) {
|
||||
break;
|
||||
}
|
||||
|
||||
//Check for a star map match, but just hold on to it,
|
||||
//if there is a shorter segment match later in a matching
|
||||
//config, then favor over this star map.
|
||||
|
|
@ -355,7 +353,11 @@ var requirejs, require, define;
|
|||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
// If the name points to a package's name, use
|
||||
// the package main instead.
|
||||
pkgMain = getOwn(config.pkgs, name);
|
||||
|
||||
return pkgMain ? pkgMain : name;
|
||||
}
|
||||
|
||||
function removeScript(name) {
|
||||
|
|
@ -377,7 +379,13 @@ var requirejs, require, define;
|
|||
//retry
|
||||
pathConfig.shift();
|
||||
context.require.undef(id);
|
||||
context.require([id]);
|
||||
|
||||
//Custom require that does not do map translation, since
|
||||
//ID is "absolute", already mapped/resolved.
|
||||
context.makeRequire(null, {
|
||||
skipMap: true
|
||||
})([id]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -565,7 +573,7 @@ var requirejs, require, define;
|
|||
mod.usingExports = true;
|
||||
if (mod.map.isDefine) {
|
||||
if (mod.exports) {
|
||||
return mod.exports;
|
||||
return (defined[mod.map.id] = mod.exports);
|
||||
} else {
|
||||
return (mod.exports = defined[mod.map.id] = {});
|
||||
}
|
||||
|
|
@ -579,15 +587,9 @@ var requirejs, require, define;
|
|||
id: mod.map.id,
|
||||
uri: mod.map.url,
|
||||
config: function () {
|
||||
var c,
|
||||
pkg = getOwn(config.pkgs, mod.map.id);
|
||||
// For packages, only support config targeted
|
||||
// at the main module.
|
||||
c = pkg ? getOwn(config.config, mod.map.id + '/' + pkg.main) :
|
||||
getOwn(config.config, mod.map.id);
|
||||
return c || {};
|
||||
return getOwn(config.config, mod.map.id) || {};
|
||||
},
|
||||
exports: defined[mod.map.id]
|
||||
exports: mod.exports || (mod.exports = {})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -870,17 +872,14 @@ var requirejs, require, define;
|
|||
exports = context.execCb(id, factory, depExports, exports);
|
||||
}
|
||||
|
||||
if (this.map.isDefine) {
|
||||
//If setting exports via 'module' is in play,
|
||||
//favor that over return value and exports. After that,
|
||||
//favor a non-undefined return value over exports use.
|
||||
// Favor return value over exports. If node/cjs in play,
|
||||
// then will not have a return value anyway. Favor
|
||||
// module.exports assignment over exports object.
|
||||
if (this.map.isDefine && exports === undefined) {
|
||||
cjsModule = this.module;
|
||||
if (cjsModule &&
|
||||
cjsModule.exports !== undefined &&
|
||||
//Make sure it is not already the exports value
|
||||
cjsModule.exports !== this.exports) {
|
||||
if (cjsModule) {
|
||||
exports = cjsModule.exports;
|
||||
} else if (exports === undefined && this.usingExports) {
|
||||
} else if (this.usingExports) {
|
||||
//exports already set the defined value.
|
||||
exports = this.exports;
|
||||
}
|
||||
|
|
@ -940,6 +939,7 @@ var requirejs, require, define;
|
|||
|
||||
on(pluginMap, 'defined', bind(this, function (plugin) {
|
||||
var load, normalizedMap, normalizedMod,
|
||||
bundleId = getOwn(bundlesMap, this.map.id),
|
||||
name = this.map.name,
|
||||
parentName = this.map.parentMap ? this.map.parentMap.name : null,
|
||||
localRequire = context.makeRequire(map.parentMap, {
|
||||
|
|
@ -985,6 +985,14 @@ var requirejs, require, define;
|
|||
return;
|
||||
}
|
||||
|
||||
//If a paths config, then just load that file instead to
|
||||
//resolve the plugin, as it is built into that paths layer.
|
||||
if (bundleId) {
|
||||
this.map.url = context.nameToUrl(bundleId);
|
||||
this.load();
|
||||
return;
|
||||
}
|
||||
|
||||
load = bind(this, function (value) {
|
||||
this.init([], function () { return value; }, null, {
|
||||
enabled: true
|
||||
|
|
@ -1249,31 +1257,38 @@ var requirejs, require, define;
|
|||
}
|
||||
}
|
||||
|
||||
//Save off the paths and packages since they require special processing,
|
||||
//Save off the paths since they require special processing,
|
||||
//they are additive.
|
||||
var pkgs = config.pkgs,
|
||||
shim = config.shim,
|
||||
var shim = config.shim,
|
||||
objs = {
|
||||
paths: true,
|
||||
bundles: true,
|
||||
config: true,
|
||||
map: true
|
||||
};
|
||||
|
||||
eachProp(cfg, function (value, prop) {
|
||||
if (objs[prop]) {
|
||||
if (prop === 'map') {
|
||||
if (!config.map) {
|
||||
config.map = {};
|
||||
}
|
||||
mixin(config[prop], value, true, true);
|
||||
} else {
|
||||
mixin(config[prop], value, true);
|
||||
if (!config[prop]) {
|
||||
config[prop] = {};
|
||||
}
|
||||
mixin(config[prop], value, true, true);
|
||||
} else {
|
||||
config[prop] = value;
|
||||
}
|
||||
});
|
||||
|
||||
//Reverse map the bundles
|
||||
if (cfg.bundles) {
|
||||
eachProp(cfg.bundles, function (value, prop) {
|
||||
each(value, function (v) {
|
||||
if (v !== prop) {
|
||||
bundlesMap[v] = prop;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//Merge shim
|
||||
if (cfg.shim) {
|
||||
eachProp(cfg.shim, function (value, id) {
|
||||
|
|
@ -1294,29 +1309,25 @@ var requirejs, require, define;
|
|||
//Adjust packages if necessary.
|
||||
if (cfg.packages) {
|
||||
each(cfg.packages, function (pkgObj) {
|
||||
var location;
|
||||
var location, name;
|
||||
|
||||
pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
|
||||
|
||||
name = pkgObj.name;
|
||||
location = pkgObj.location;
|
||||
if (location) {
|
||||
config.paths[name] = pkgObj.location;
|
||||
}
|
||||
|
||||
//Create a brand new object on pkgs, since currentPackages can
|
||||
//be passed in again, and config.pkgs is the internal transformed
|
||||
//state for all package configs.
|
||||
pkgs[pkgObj.name] = {
|
||||
name: pkgObj.name,
|
||||
location: location || pkgObj.name,
|
||||
//Remove leading dot in main, so main paths are normalized,
|
||||
//and remove any trailing .js, since different package
|
||||
//envs have different conventions: some use a module name,
|
||||
//some use a file name.
|
||||
main: (pkgObj.main || 'main')
|
||||
.replace(currDirRegExp, '')
|
||||
.replace(jsSuffixRegExp, '')
|
||||
};
|
||||
//Save pointer to main module ID for pkg name.
|
||||
//Remove leading dot in main, so main paths are normalized,
|
||||
//and remove any trailing .js, since different package
|
||||
//envs have different conventions: some use a module name,
|
||||
//some use a file name.
|
||||
config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
|
||||
.replace(currDirRegExp, '')
|
||||
.replace(jsSuffixRegExp, '');
|
||||
});
|
||||
|
||||
//Done with modifications, assing packages back to context config
|
||||
config.pkgs = pkgs;
|
||||
}
|
||||
|
||||
//If there are any "waiting to execute" modules in the registry,
|
||||
|
|
@ -1497,7 +1508,7 @@ var requirejs, require, define;
|
|||
/**
|
||||
* Called to enable a module if it is still in the registry
|
||||
* awaiting enablement. A second arg, parent, the parent module,
|
||||
* is passed in for context, when this method is overriden by
|
||||
* is passed in for context, when this method is overridden by
|
||||
* the optimizer. Not shown here to keep code compact.
|
||||
*/
|
||||
enable: function (depMap) {
|
||||
|
|
@ -1571,8 +1582,19 @@ var requirejs, require, define;
|
|||
* internal API, not a public one. Use toUrl for the public API.
|
||||
*/
|
||||
nameToUrl: function (moduleName, ext, skipExt) {
|
||||
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
|
||||
parentPath;
|
||||
var paths, syms, i, parentModule, url,
|
||||
parentPath, bundleId,
|
||||
pkgMain = getOwn(config.pkgs, moduleName);
|
||||
|
||||
if (pkgMain) {
|
||||
moduleName = pkgMain;
|
||||
}
|
||||
|
||||
bundleId = getOwn(bundlesMap, moduleName);
|
||||
|
||||
if (bundleId) {
|
||||
return context.nameToUrl(bundleId, ext, skipExt);
|
||||
}
|
||||
|
||||
//If a colon is in the URL, it indicates a protocol is used and it is just
|
||||
//an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
|
||||
|
|
@ -1586,7 +1608,6 @@ var requirejs, require, define;
|
|||
} else {
|
||||
//A module that needs to be converted to a path.
|
||||
paths = config.paths;
|
||||
pkgs = config.pkgs;
|
||||
|
||||
syms = moduleName.split('/');
|
||||
//For each module name segment, see if there is a path
|
||||
|
|
@ -1594,7 +1615,7 @@ var requirejs, require, define;
|
|||
//and work up from it.
|
||||
for (i = syms.length; i > 0; i -= 1) {
|
||||
parentModule = syms.slice(0, i).join('/');
|
||||
pkg = getOwn(pkgs, parentModule);
|
||||
|
||||
parentPath = getOwn(paths, parentModule);
|
||||
if (parentPath) {
|
||||
//If an array, it means there are a few choices,
|
||||
|
|
@ -1604,16 +1625,6 @@ var requirejs, require, define;
|
|||
}
|
||||
syms.splice(0, i, parentPath);
|
||||
break;
|
||||
} else if (pkg) {
|
||||
//If module name is just the package name, then looking
|
||||
//for the main module.
|
||||
if (moduleName === pkg.name) {
|
||||
pkgPath = pkg.location + '/' + pkg.main;
|
||||
} else {
|
||||
pkgPath = pkg.location;
|
||||
}
|
||||
syms.splice(0, i, pkgPath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,24 +23,27 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="../build/src-noconflict/ext-modelist.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/modelist"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
(function () {
|
||||
var modelist = ace.require('ace/ext/modelist');
|
||||
var modelist = ace.require("ace/ext/modelist");
|
||||
// the file path could come from an xmlhttp request, a drop event,
|
||||
// or any other scriptable file loading process.
|
||||
// Extensions could consume the modelist and use it to dynamically
|
||||
// set the editor mode. Webmasters could use it in their scripts
|
||||
// for site specific purposes as well.
|
||||
var filePath = 'blahblah/weee/some.js';
|
||||
var filePath = "blahblah/weee/some.js";
|
||||
var mode = modelist.getModeForPath(filePath).mode;
|
||||
console.log(mode);
|
||||
editor.session.setMode(mode);
|
||||
}());
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
20
demo/r.js/build.js
Normal file
20
demo/r.js/build.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
({
|
||||
optimize: "none",
|
||||
preserveLicenseComments: false,
|
||||
name: "node_modules/almond/almond",
|
||||
baseUrl: "../../",
|
||||
paths: {
|
||||
ace : "lib/ace",
|
||||
demo: "demo/kitchen-sink"
|
||||
},
|
||||
packages: [
|
||||
],
|
||||
include: [
|
||||
"ace/ace"
|
||||
],
|
||||
exclude: [
|
||||
],
|
||||
out: "./packed.js",
|
||||
useStrict: true,
|
||||
wrap: false
|
||||
})
|
||||
36
demo/r.js/editor.html
Normal file
36
demo/r.js/editor.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Editor</title>
|
||||
<link rel="stylesheet" href="../kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<div id="optionsPanel" style="position:absolute;height:100%;width:260px">
|
||||
<a href="http://c9.io" title="Cloud9 IDE | Your code anywhere, anytime">
|
||||
<img id="c9-logo" src="../kitchen-sink/logo.png" style="width: 172px;margin: -9px 30px -12px 51px;">
|
||||
</a>
|
||||
</div>
|
||||
<pre id="editor-container">
|
||||
<div style="color:black; padding: 10px">
|
||||
demo showing Ace usage with r.js:
|
||||
|
||||
install r.js and almond
|
||||
and run `<code>r.js -o demo/r.js/build.js</code>`
|
||||
|
||||
note that you also need ace/build/src to lazy load modes and themes
|
||||
require("ace/config").set("basePath", "../../build/src");
|
||||
require("ace/config").set("packaged", true);
|
||||
<div>
|
||||
</pre>
|
||||
|
||||
<script src="./packed.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
require("ace/config").set("basePath", "../../build/src")
|
||||
require("ace/config").set("packaged", true)
|
||||
var editor = require("ace/ace").edit("editor-container");
|
||||
editor.session.setMode("ace/mode/javascript");
|
||||
// editor.session.setValue("var editor = Ace!")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -29,14 +29,20 @@
|
|||
}</pre>
|
||||
|
||||
<script src="../demo/kitchen-sink/require.js"></script>
|
||||
<script src="../build/src/ace.js" charset="utf-8"></script>
|
||||
<script>
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
editor.session.setMode("ace/mode/javascript");
|
||||
require(["ace/requirejs/text!src/ace"], function(e){
|
||||
editor.setValue(e);
|
||||
})
|
||||
require.config({paths: {ace: "../build/src"}})
|
||||
define('testace', ['ace/ace'],
|
||||
function(ace, langtools) {
|
||||
console.log("This is the testace module");
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
editor.session.setMode("ace/mode/javascript");
|
||||
require(["ace/requirejs/text!src/ace"], function(e){
|
||||
editor.setValue(e);
|
||||
})
|
||||
}
|
||||
);
|
||||
require(['testace'])
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -5,19 +5,18 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
.ace_editor {
|
||||
position: relative !important;
|
||||
border: 1px solid lightgray;
|
||||
margin: auto;
|
||||
height: 200px;
|
||||
width: 80%;
|
||||
}
|
||||
.ace_editor {
|
||||
position: relative !important;
|
||||
border: 1px solid lightgray;
|
||||
margin: auto;
|
||||
height: 200px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.ace_editor.fullScreen {
|
||||
height: auto;
|
||||
width: auto;
|
||||
border: 0;
|
||||
height: auto;
|
||||
width: auto;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
position: fixed !important;
|
||||
top: 0;
|
||||
|
|
@ -25,17 +24,16 @@
|
|||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.fullScreen {
|
||||
overflow: hidden
|
||||
}
|
||||
.fullScreen {
|
||||
overflow: hidden
|
||||
}
|
||||
|
||||
.scrollmargin {
|
||||
height: 500px;
|
||||
.scrollmargin {
|
||||
height: 500px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.large-button {
|
||||
color: lightblue;
|
||||
|
|
@ -56,7 +54,7 @@
|
|||
<body>
|
||||
<div class="scrollmargin">
|
||||
<span onclick="scroll()" class="large-button">
|
||||
scroll down ⇓
|
||||
scroll down ⇓
|
||||
</span>
|
||||
</div>
|
||||
<pre id="editor">function foo(items) {
|
||||
|
|
@ -76,28 +74,35 @@
|
|||
|
||||
</div>
|
||||
|
||||
<script src="../build/src/ace.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
require(["ace/ace", "ace/ext/themelist"], function(ace) {
|
||||
|
||||
var $ = document.getElementById.bind(document);
|
||||
var dom = require("ace/lib/dom");
|
||||
|
||||
//add command to all new editor instaces
|
||||
require("ace/commands/default_commands").commands.push({
|
||||
name: "Toggle Fullscreen",
|
||||
bindKey: "F11",
|
||||
exec: function(editor) {
|
||||
dom.toggleCssClass(document.body, "fullScreen")
|
||||
dom.toggleCssClass(editor.container, "fullScreen")
|
||||
editor.setAutoScrollEditorIntoView()
|
||||
editor.resize()
|
||||
}
|
||||
name: "Toggle Fullscreen",
|
||||
bindKey: "F11",
|
||||
exec: function(editor) {
|
||||
var fullScreen = dom.toggleCssClass(document.body, "fullScreen")
|
||||
dom.setCssClass(editor.container, "fullScreen", fullScreen)
|
||||
editor.setAutoScrollEditorIntoView(!fullScreen)
|
||||
editor.resize()
|
||||
}
|
||||
})
|
||||
|
||||
// create first editor
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
editor.session.setMode("ace/mode/javascript");
|
||||
editor.setAutoScrollEditorIntoView();
|
||||
editor.renderer.setScrollMargin(10, 10);
|
||||
editor.setOptions({
|
||||
// "scrollPastEnd": 0.8,
|
||||
autoScrollEditorIntoView: true
|
||||
});
|
||||
|
||||
var count = 1;
|
||||
function add() {
|
||||
|
|
@ -110,12 +115,13 @@ function add() {
|
|||
oldEl.parentNode.insertBefore(el, pad.nextSibling)
|
||||
|
||||
count++
|
||||
var theme = "ace/theme/" + themes[Math.floor(themes.length * Math.random() - 1e-5)]
|
||||
var theme = themes[Math.floor(themes.length * Math.random() - 1e-5)]
|
||||
editor = ace.edit(el)
|
||||
editor.setTheme(theme)
|
||||
editor.session.setMode("ace/mode/javascript")
|
||||
|
||||
editor.setAutoScrollEditorIntoView()
|
||||
editor.setOptions({
|
||||
mode: "ace/mode/javascript",
|
||||
theme: theme,
|
||||
autoScrollEditorIntoView: true
|
||||
})
|
||||
|
||||
editor.setValue([
|
||||
"this is editor number: ", count, "\n",
|
||||
|
|
@ -126,7 +132,6 @@ function add() {
|
|||
scroll()
|
||||
}
|
||||
|
||||
|
||||
function scroll(speed) {
|
||||
var top = editor.container.getBoundingClientRect().top
|
||||
speed = speed || 10
|
||||
|
|
@ -139,14 +144,11 @@ function scroll(speed) {
|
|||
}
|
||||
}
|
||||
|
||||
var themes = {
|
||||
bright: [ "chrome", "clouds", "crimson_editor", "dawn", "dreamweaver", "eclipse", "github",
|
||||
"solarized_light", "textmate", "tomorrow"],
|
||||
dark: [ "clouds_midnight", "cobalt", "idle_fingers", "kr_theme", "merbivore", "merbivore_soft",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "solarized_dark", "terminal", "tomorrow_night",
|
||||
"tomorrow_night_blue", "tomorrow_night_bright", "tomorrow_night_eighties", "twilight", "vibrant_ink"]
|
||||
}
|
||||
themes = [].concat(themes.bright, themes.dark);
|
||||
var themes = require("ace/ext/themelist").themes.map(function(t){return t.theme});
|
||||
|
||||
window.add = add;
|
||||
window.scroll = scroll;
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -23,9 +23,12 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="../build/src-noconflict/ext-settings_menu.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/settings_menu"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
ace.require('ace/ext/settings_menu').init(editor);
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
|
@ -38,6 +41,7 @@
|
|||
},
|
||||
readOnly: true
|
||||
}]);
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,16 @@
|
|||
ace.require("ace/lib/net").get(document.baseURI, function(t){
|
||||
editor.setValue(t, 1);
|
||||
})
|
||||
if (typeof ace == "undefined" && typeof require == "undefined") {
|
||||
document.body.innerHTML = "<p style='padding: 20px 50px;'>couldn't find ace.js file, <br>"
|
||||
+ "to build it run <code>node Makefile.dryice.js full<code>"
|
||||
} else if (typeof ace == "undefined" && typeof require != "undefined") {
|
||||
require(["ace/ace"], setValue)
|
||||
} else {
|
||||
require = ace.require;
|
||||
setValue()
|
||||
}
|
||||
|
||||
function setValue() {
|
||||
require("ace/lib/net").get(document.baseURI, function(t){
|
||||
var el = document.getElementById("editor");
|
||||
el.env.editor.setValue(t, 1);
|
||||
})
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
|
@ -34,30 +33,31 @@ function wobble (flam) {
|
|||
return flam.wobbled = true;
|
||||
}
|
||||
|
||||
// the scrollbars are from overflow auto on .ace_editor.
|
||||
|
||||
</pre>
|
||||
|
||||
<script src="../../build/src-noconflict/ace.js"></script>
|
||||
<script src="../../build/src-noconflict/ext-static_highlight.js"></script>
|
||||
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
var highlight = ace.require("ace/ext/static_highlight")
|
||||
var dom = ace.require("ace/lib/dom")
|
||||
function qsa(sel) {
|
||||
return [].slice.call(document.querySelectorAll(sel));
|
||||
}
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
|
||||
qsa(".code").forEach(function (codeEl) {
|
||||
highlight(codeEl, {
|
||||
mode: codeEl.getAttribute('ace-mode'),
|
||||
theme: codeEl.getAttribute('ace-theme'),
|
||||
startLineNumber: 1,
|
||||
showGutter: codeEl.getAttribute("ace-gutter"),
|
||||
trim: true
|
||||
}, function (highlighted) {
|
||||
require(["ace/ace", "ace/ext/static_highlight"], function(ace) {
|
||||
var highlight = ace.require("ace/ext/static_highlight")
|
||||
var dom = ace.require("ace/lib/dom")
|
||||
function qsa(sel) {
|
||||
return Array.apply(null, document.querySelectorAll(sel));
|
||||
}
|
||||
|
||||
qsa(".code").forEach(function (codeEl) {
|
||||
highlight(codeEl, {
|
||||
mode: codeEl.getAttribute("ace-mode"),
|
||||
theme: codeEl.getAttribute("ace-theme"),
|
||||
startLineNumber: 1,
|
||||
showGutter: codeEl.getAttribute("ace-gutter"),
|
||||
trim: true
|
||||
}, function (highlighted) {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
@ -41,15 +41,19 @@
|
|||
<pre id="editor"></pre>
|
||||
<div id="statusBar">ace rocks!</div>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="../build/src-noconflict/ext-statusbar.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/statusbar"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
var StatusBar = ace.require('ace/ext/statusbar').StatusBar;
|
||||
var StatusBar = ace.require("ace/ext/statusbar").StatusBar;
|
||||
// create a simple selection status indicator
|
||||
var statusBar = new StatusBar(editor, document.getElementById('statusBar'));
|
||||
var statusBar = new StatusBar(editor, document.getElementById("statusBar"));
|
||||
editor.setTheme("ace/theme/dawn");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
|
|
@ -161,7 +161,7 @@ function highlight() {
|
|||
var highlighter = ace.require("ace/ext/static_highlight")
|
||||
var dom = ace.require("ace/lib/dom")
|
||||
function qsa(sel) {
|
||||
return [].slice.call(document.querySelectorAll(sel));
|
||||
return Array.apply(null, document.querySelectorAll(sel));
|
||||
}
|
||||
|
||||
qsa("code[class]").forEach(function(el) {
|
||||
|
|
|
|||
104
index.html
104
index.html
|
|
@ -9,12 +9,15 @@
|
|||
<link href="./doc/site/style.css" rel="stylesheet" type="text/css" />
|
||||
<link href="./doc/site/images/favicon.ico" rel="icon" type="image/x-icon" />
|
||||
|
||||
<script src="./build/src-min/ace.js"></script>
|
||||
<script src="./build/src-min/ext-static_highlight.js"></script>
|
||||
<script src="./build/src/ace.js"></script>
|
||||
<script src="./build/src/ext-static_highlight.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="./build/src/ext-old_ie.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<a href="http://github.com/ajaxorg/ace">
|
||||
<img style="z-index: 50000; position: absolute; top: 0; right: 0; border: 0; width: 125px; height: 125px" src="https://a248.e.akamai.net/camo.github.com/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" />
|
||||
<img style="z-index: 50000; position: absolute; top: 0; right: 0; border: 0; width: 125px; height: 125px" src="https://camo.githubusercontent.com/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" />
|
||||
</a>
|
||||
<div id="wrapper">
|
||||
<div class="content">
|
||||
|
|
@ -65,7 +68,7 @@
|
|||
and is the successor of the Mozilla Skywriter (Bespin) project.
|
||||
</p>
|
||||
|
||||
<div id="ace_editor_demo" style="opacity:0">/**
|
||||
<pre id="ace_editor_demo" style="opacity:0">/**
|
||||
* In fact, you're looking at ACE right now. Go ahead and play with it!
|
||||
*
|
||||
* We are currently showing off the JavaScript mode. ACE has support for 45
|
||||
|
|
@ -80,7 +83,7 @@ function add(x, y) {
|
|||
|
||||
var addResult = add(3, 2);
|
||||
console.log(addResult);
|
||||
</div>
|
||||
</pre>
|
||||
<p id="embed_link"><a href="#nav=embedding">Learn how to embed this in your own site</a></p>
|
||||
<p class="highlight_note">Looking for a more full-featured demo? Check out the
|
||||
<a href="build/kitchen-sink.html" target="_blank">kitchen sink</a>.
|
||||
|
|
@ -140,7 +143,7 @@ console.log(addResult);
|
|||
<h1>Embedding Ace in Your Site</h1>
|
||||
<p>Ace can be easily embedded into a web page. Get prebuilt version of ace from
|
||||
<a href="https://github.com/ajaxorg/ace-builds/">ace-builds</a> repository and use the code below:</p>
|
||||
<div id="embedded_ace_code" style="opacity:0"><!DOCTYPE html>
|
||||
<pre id="embedded_ace_code" style="opacity:0"><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>ACE in Action</title>
|
||||
|
|
@ -168,7 +171,7 @@ console.log(addResult);
|
|||
editor.getSession().setMode("ace/mode/javascript");
|
||||
</script>
|
||||
</body>
|
||||
</html></div>
|
||||
</html></pre>
|
||||
<p>Now check out the <a href="#nav=howto">How-To Guide</a> for instructions on
|
||||
common operations, such as setting a different language mode or
|
||||
getting the contents from the editor.
|
||||
|
|
@ -785,7 +788,7 @@ if (match) {
|
|||
<img src="doc/site/images/zorba-logo.png"
|
||||
style="left: -5px; top: 16px;
|
||||
padding: 6px 4px 6px 6px; width: 100px" />
|
||||
<a href="http://www.zorba-xquery.com/html/demo">Zorba XQuery</a>
|
||||
<a href="http://try.zorba.io/queries/xquery">Zorba XQuery</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="doc/site/images/plunker.png"
|
||||
|
|
@ -871,9 +874,9 @@ if (match) {
|
|||
<a href="https://drivenotepad.appspot.com/support">Drive Notepad</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="doc/site/images/FineCut_small_logo.png"
|
||||
style="left: 12px; top: -4px" />
|
||||
<a href="http://finecut.info/">Fine Cut Engine</a>
|
||||
<img src="http://textor.houfeng.net/images/textor.png"
|
||||
style="position: relative; left: 13px; top: -3px; width: 75px" />
|
||||
<a href="http://textor.houfeng.net/">Textor</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://phpassist.com/images/logo-large.png"
|
||||
|
|
@ -907,9 +910,9 @@ if (match) {
|
|||
<a href="http://orbit.bonsaijs.org/">BonsaiJS playground</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="doc/site/images/acebug-logo.png"
|
||||
style="left: 20px; top: 5px;">
|
||||
<a href="https://addons.mozilla.org/en-US/firefox/addon/acebug/">Acebug</a>
|
||||
<img src="http://approximatrix.com/products/simplytext/logo-320x320.png"
|
||||
style="width: 106px; left: -4px; top: -22px;">
|
||||
<a href="http://approximatrix.com/products/simplytext">Simply Text</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo" style="font-size: 18px;">ShareLaTeX</div>
|
||||
|
|
@ -1109,7 +1112,7 @@ if (match) {
|
|||
<a href="http://bakemycss.mypathforpython.appspot.com/">BakeMyCss</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="" style="
|
||||
<div style="
|
||||
background: url(https://s3.amazonaws.com/spark-website/spark.png) no-repeat;
|
||||
position: absolute; height: 65px; width: 83px; background-size: 200px 65px;
|
||||
background-position: 19px;"></div>
|
||||
|
|
@ -1128,7 +1131,56 @@ if (match) {
|
|||
<a href=" http://www.praczone.com/editor">pracZone</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
|
||||
<img src="http://resources.qooxdoo.org/images/logo.gif"
|
||||
style="width: 125px; left: -13px; top: 18px;">
|
||||
<a href="http://demo.qooxdoo.org/devel/playground/#">Qooxdoo playground</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo">ShareJS</div>
|
||||
<a href="http://sharejs.org/hello-ace.html">ShareJS</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="https://neutron-drive.appspot.com/static/img/neutron_face_high.png"
|
||||
style="width: 86px; left: 7px; top: -11px;">
|
||||
<a href="http://neutronide.com/">Neutron IDE</a>
|
||||
</li>
|
||||
<li>
|
||||
<div style="
|
||||
background: url(https://www.pythonanywhere.com/static/anywhere/images/logo-234x35.png) no-repeat;
|
||||
position: absolute; height: 65px; width: 94px; background-size: 234px 35px;
|
||||
background-position: 19px;"></div>
|
||||
<a href="http://www.pythonanywhere.com/">PythonAnywhere</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://subtexteditor.com/images/subtext-icon-4.png"
|
||||
style="width: 86px; left: 7px; top: -11px;">
|
||||
<a href="http://subtexteditor.com/">Subtext Editor</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://climbi.com/static/img/logo.png"
|
||||
style="width: 86px; left: 7px; top: -11px;">
|
||||
<a href="http://climbi.com/">Climbi</a>
|
||||
</li>
|
||||
<li>
|
||||
<div style="
|
||||
background: url(http://gpupowered.org/sites/default/files/favicon.png) rgba(0, 0, 0, 0.66) no-repeat;
|
||||
position: absolute;
|
||||
height: 75px;
|
||||
width: 99px; background-size: 27px 32px;
|
||||
background-position: 37px;"></div>
|
||||
<a href="http://www.gpupowered.org/sand2/launch2/#">GPUPowered</a>
|
||||
</li>
|
||||
<li style="width: 248px;">
|
||||
<img src="http://www.codeavengers.com/image/RedLogoSmall.png" style="width: 248px; top: 30px;">
|
||||
<a href="http://www.codeavengers.com/image/RedLogoSmall.png">Code Avengers</a>
|
||||
</li>
|
||||
<li style="width: 248px;">
|
||||
<img src="http://www.codemonkey.co.il/images/logoSmallFaceTop.png" style="width: 248px; top: -3px;">
|
||||
<a href="http://www.codemonkey.co.il/">CodeMonkey</a>
|
||||
</li>
|
||||
<li style="width: 248px;">
|
||||
<img src="http://learn-angular.org/Content/Images/LearnAngular-small.png" style="width: 275px; left: -12px; top: 7px;">
|
||||
<a href="http://learn-angular.org">Learn Angular</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wavemaker.com/">WaveMaker</a>
|
||||
|
|
@ -1136,35 +1188,15 @@ if (match) {
|
|||
<li>
|
||||
<a href="http://www.playmycode.com/">Play My Code</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://resources.qooxdoo.org/images/logo.gif"
|
||||
style="width: 125px; left: -13px; top: 18px;">
|
||||
<a href="http://demo.qooxdoo.org/devel/playground/#">Qooxdoo playground</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ext.radiantcms.org/extensions/264-ace">Radiant CMS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://developercompanion.com/">Developer Companion</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.pythonanywhere.com/">PythonAnywhere</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo">ShareJS</div>
|
||||
<a href="http://sharejs.org/hello-ace.html">ShareJS</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="https://neutron-drive.appspot.com/static/img/neutron_face_high.png"
|
||||
style="width: 76px; left: 7px; top: -11px;">
|
||||
<a href="http://neutronide.com/">Neutron IDE</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.akshell.com/">Akshell</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://beanstalkapp.com/">beanstalk</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<div class="text-logo">tmpltr</div>
|
||||
|
|
|
|||
|
|
@ -11,16 +11,10 @@
|
|||
commit %commit%
|
||||
-->
|
||||
|
||||
<!--DEVEL-->
|
||||
<link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
|
||||
<!--DEVEL-->
|
||||
<link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
<script async="true" src="https://use.edgefonts.net/source-code-pro.js"></script>
|
||||
|
||||
<link href="./doc/site/images/favicon.ico" rel="icon" type="image/x-icon">
|
||||
<!--PACKAGE
|
||||
<link rel="stylesheet" href="kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
|
||||
PACKAGE-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="optionsPanel" style="position:absolute;height:100%;width:260px">
|
||||
|
|
@ -287,7 +281,7 @@
|
|||
<script src="src/ace.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/keybinding-vim.js"></script>
|
||||
<script src="src/keybinding-emacs.js"></script>
|
||||
<script src="kitchen-sink/demo.js"></script>
|
||||
<script src="demo/kitchen-sink/demo.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
require("kitchen-sink/demo");
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ var Editor = require("./editor").Editor;
|
|||
var EditSession = require("./edit_session").EditSession;
|
||||
var UndoManager = require("./undomanager").UndoManager;
|
||||
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
||||
var MultiSelect = require("./multi_select").MultiSelect;
|
||||
|
||||
// The following require()s are for inclusion in the built ace file
|
||||
require("./worker/worker_client");
|
||||
require("./keyboard/hash_handler");
|
||||
require("./placeholder");
|
||||
require("./multi_select");
|
||||
require("./mode/folding/fold_mode");
|
||||
require("./theme/textmate");
|
||||
require("./ext/error_marker");
|
||||
|
|
@ -74,7 +74,7 @@ exports.require = require;
|
|||
exports.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
var _id = el;
|
||||
var el = document.getElementById(_id);
|
||||
el = document.getElementById(_id);
|
||||
if (!el)
|
||||
throw new Error("ace.edit can't find div #" + _id);
|
||||
}
|
||||
|
|
@ -86,7 +86,6 @@ exports.edit = function(el) {
|
|||
el.innerHTML = '';
|
||||
|
||||
var editor = new Editor(new Renderer(el));
|
||||
new MultiSelect(editor);
|
||||
editor.setSession(doc);
|
||||
|
||||
var env = {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,15 @@ module.exports = {
|
|||
doc.insert({row: 1, column: 1}, "123");
|
||||
assert.position(anchor.getPosition(), 1, 7);
|
||||
},
|
||||
|
||||
"test insert text at anchor should not move anchor when insertRight is true": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
anchor.$insertRight = true;
|
||||
|
||||
doc.insert({row: 1, column: 4}, "123");
|
||||
assert.position(anchor.getPosition(), 1, 4);
|
||||
},
|
||||
|
||||
"test insert lines before cursor should move anchor row": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
|
|
@ -65,6 +74,32 @@ module.exports = {
|
|||
doc.insertFullLines(1, ["123", "456"]);
|
||||
assert.position(anchor.getPosition(), 3, 4);
|
||||
},
|
||||
|
||||
"test insert lines at anchor position should move anchor down": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 0);
|
||||
|
||||
doc.insertLines(1, ["line"]);
|
||||
assert.position(anchor.getPosition(), 2, 0);
|
||||
},
|
||||
|
||||
"test insert lines at anchor position should not move anchor down when insertRight is true and column is 0": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 0);
|
||||
anchor.$insertRight = true;
|
||||
|
||||
doc.insertLines(1, ["line"]);
|
||||
assert.position(anchor.getPosition(), 1, 0);
|
||||
},
|
||||
|
||||
"test insert lines at anchor row should move anchor down when column > 0": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 2);
|
||||
anchor.$insertRight = true;
|
||||
|
||||
doc.insertLines(1, ["line"]);
|
||||
assert.position(anchor.getPosition(), 2, 2);
|
||||
},
|
||||
|
||||
"test insert new line before cursor should move anchor column": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ var Autocomplete = function() {
|
|||
|
||||
this.changeTimer = lang.delayedCall(function() {
|
||||
this.updateCompletions(true);
|
||||
}.bind(this))
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -63,6 +63,7 @@ var Autocomplete = function() {
|
|||
this.insertMatch();
|
||||
e.stop();
|
||||
}.bind(this));
|
||||
this.popup.focus = this.editor.focus.bind(this.editor);
|
||||
};
|
||||
|
||||
this.openPopup = function(editor, prefix, keepPopupPosition) {
|
||||
|
|
@ -122,7 +123,10 @@ var Autocomplete = function() {
|
|||
};
|
||||
|
||||
this.blurListener = function() {
|
||||
if (document.activeElement != this.editor.textInput.getElement())
|
||||
// we have to check if activeElement is a child of popup because
|
||||
// on IE preventDefault doesn't stop scrollbar from being focussed
|
||||
var el = document.activeElement;
|
||||
if (el != this.editor.textInput.getElement() && el.parentNode != this.popup.container)
|
||||
this.detach();
|
||||
};
|
||||
|
||||
|
|
@ -139,7 +143,7 @@ var Autocomplete = function() {
|
|||
var max = this.popup.session.getLength() - 1;
|
||||
|
||||
switch(where) {
|
||||
case "up": row = row < 0 ? max : row - 1; break;
|
||||
case "up": row = row <= 0 ? max : row - 1; break;
|
||||
case "down": row = row >= max ? -1 : row + 1; break;
|
||||
case "start": row = 0; break;
|
||||
case "end": row = max; break;
|
||||
|
|
@ -180,13 +184,15 @@ var Autocomplete = function() {
|
|||
|
||||
"Esc": function(editor) { editor.completer.detach(); },
|
||||
"Space": function(editor) { editor.completer.detach(); editor.insert(" ");},
|
||||
"Return": function(editor) {
|
||||
if (editor.completer.popup.getRow() == -1)
|
||||
return false;
|
||||
editor.completer.insertMatch();
|
||||
},
|
||||
"Return": function(editor) { return editor.completer.insertMatch(); },
|
||||
"Shift-Return": function(editor) { editor.completer.insertMatch(true); },
|
||||
"Tab": function(editor) { editor.completer.insertMatch(); },
|
||||
"Tab": function(editor) {
|
||||
var result = editor.completer.insertMatch();
|
||||
if (!result && !editor.tabstopManager)
|
||||
editor.completer.goTo("down");
|
||||
else
|
||||
return result;
|
||||
},
|
||||
|
||||
"PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
|
||||
"PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
|
||||
|
|
@ -208,16 +214,16 @@ var Autocomplete = function() {
|
|||
completer.getCompletions(editor, session, pos, prefix, function(err, results) {
|
||||
if (!err)
|
||||
matches = matches.concat(results);
|
||||
// Fetch prefix again, because they may have changed by now
|
||||
var pos = editor.getCursorPosition();
|
||||
var line = session.getLine(pos.row);
|
||||
callback(null, {
|
||||
prefix: util.retrievePrecedingIdentifier(line, pos.column),
|
||||
// Fetch prefix again, because they may have changed by now
|
||||
var pos = editor.getCursorPosition();
|
||||
var line = session.getLine(pos.row);
|
||||
callback(null, {
|
||||
prefix: util.retrievePrecedingIdentifier(line, pos.column, results[0] && results[0].identifierRegex),
|
||||
matches: matches,
|
||||
finished: (--total === 0)
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
@ -264,31 +270,19 @@ var Autocomplete = function() {
|
|||
var _id = this.gatherCompletionsId;
|
||||
this.gatherCompletions(this.editor, function(err, results) {
|
||||
// Only detach if result gathering is finished
|
||||
var doDetach = function() {
|
||||
var detachIfFinished = function() {
|
||||
if (!results.finished) return;
|
||||
return this.detach();
|
||||
}.bind(this);
|
||||
|
||||
// Calcul prefix
|
||||
var session = this.editor.getSession();
|
||||
var pos = this.editor.getCursorPosition();
|
||||
var line = session.getLine(pos.row);
|
||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||
|
||||
// Results matches
|
||||
var prefix = results.prefix;
|
||||
var matches = results && results.matches;
|
||||
|
||||
if (!matches || !matches.length)
|
||||
return this.detach();
|
||||
// TODO reenable this when we have proper change tracking
|
||||
// if (matches.length == 1)
|
||||
// return this.insertMatch(matches[0]);
|
||||
|
||||
// No prefix or no results -> close
|
||||
if (!prefix || !prefix.length || !matches || !matches.length)
|
||||
return doDetach();
|
||||
return detachIfFinished();
|
||||
|
||||
// Wrong prefix or wrong session -> ignore
|
||||
if (prefix.indexOf(results.prefix) != 0 || _id != this.gatherCompletionsId)
|
||||
if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
|
||||
return;
|
||||
|
||||
this.completions = new FilteredList(matches);
|
||||
|
|
@ -297,11 +291,11 @@ var Autocomplete = function() {
|
|||
|
||||
// No results
|
||||
if (!filtered.length)
|
||||
return doDetach();
|
||||
return detachIfFinished();
|
||||
|
||||
// One result equals to the prefix
|
||||
if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
|
||||
return doDetach();
|
||||
return detachIfFinished();
|
||||
|
||||
// Autoinsert if one result
|
||||
if (this.autoInsert && filtered.length == 1)
|
||||
|
|
@ -312,13 +306,7 @@ var Autocomplete = function() {
|
|||
};
|
||||
|
||||
this.cancelContextMenu = function() {
|
||||
var stop = function(e) {
|
||||
this.editor.off("nativecontextmenu", stop);
|
||||
if (e && e.domEvent)
|
||||
event.stopEvent(e.domEvent);
|
||||
}.bind(this);
|
||||
setTimeout(stop, 10);
|
||||
this.editor.on("nativecontextmenu", stop);
|
||||
this.editor.$mouseHandler.cancelContextMenu();
|
||||
};
|
||||
|
||||
}).call(Autocomplete.prototype);
|
||||
|
|
@ -328,6 +316,8 @@ Autocomplete.startCommand = {
|
|||
exec: function(editor) {
|
||||
if (!editor.completer)
|
||||
editor.completer = new Autocomplete();
|
||||
editor.completer.autoInsert =
|
||||
editor.completer.autoSelect = true;
|
||||
editor.completer.showPopup(editor);
|
||||
// needed for firefox on mac
|
||||
editor.completer.cancelContextMenu();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
define(function(require, exports, module) {
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var splitRegex = /[^a-zA-Z_0-9\$\-]+/;
|
||||
var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
|
||||
|
||||
function getWordIndex(doc, pos) {
|
||||
var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ exports.parForEach = function(array, fn, callback) {
|
|||
callback(result, err);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var ID_REGEX = /[a-zA-Z_0-9\$-]/;
|
||||
var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
|
||||
|
||||
exports.retrievePrecedingIdentifier = function(text, pos, regex) {
|
||||
regex = regex || ID_REGEX;
|
||||
|
|
@ -57,7 +57,7 @@ exports.retrievePrecedingIdentifier = function(text, pos, regex) {
|
|||
break;
|
||||
}
|
||||
return buf.reverse().join("");
|
||||
}
|
||||
};
|
||||
|
||||
exports.retrieveFollowingIdentifier = function(text, pos, regex) {
|
||||
regex = regex || ID_REGEX;
|
||||
|
|
@ -69,6 +69,6 @@ exports.retrieveFollowingIdentifier = function(text, pos, regex) {
|
|||
break;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ define(function(require, exports, module) {
|
|||
|
||||
var lang = require("../lib/lang");
|
||||
var config = require("../config");
|
||||
var Range = require("../range").Range;
|
||||
|
||||
function bindKey(win, mac) {
|
||||
return {win: win, mac: mac};
|
||||
|
|
@ -141,15 +142,19 @@ exports.commands = [{
|
|||
name: "findnext",
|
||||
bindKey: bindKey("Ctrl-K", "Command-G"),
|
||||
exec: function(editor) { editor.findNext(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "center",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "findprevious",
|
||||
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
|
||||
exec: function(editor) { editor.findPrevious(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "center",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectOrFindNext",
|
||||
bindKey: bindKey("ALt-K", "Ctrl-G"),
|
||||
bindKey: bindKey("Alt-K", "Ctrl-G"),
|
||||
exec: function(editor) {
|
||||
if (editor.selection.isEmpty())
|
||||
editor.selection.selectWord();
|
||||
|
|
@ -387,17 +392,23 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "jumptomatching",
|
||||
bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"),
|
||||
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
|
||||
exec: function(editor) { editor.jumpToMatching(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selecttomatching",
|
||||
bindKey: bindKey("Ctrl-Shift-P", null),
|
||||
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
|
||||
exec: function(editor) { editor.jumpToMatching(true); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
},
|
||||
}, {
|
||||
name: "passKeysToBrowser",
|
||||
bindKey: bindKey("null", "null"),
|
||||
exec: function() {},
|
||||
passEvent: true,
|
||||
readOnly: true
|
||||
},
|
||||
|
||||
// commands disabled in readOnly mode
|
||||
{
|
||||
|
|
@ -598,6 +609,100 @@ exports.commands = [{
|
|||
exec: function(editor) { editor.toLowerCase(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor"
|
||||
}, {
|
||||
name: "expandtoline",
|
||||
bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
|
||||
exec: function(editor) {
|
||||
var range = editor.selection.getRange();
|
||||
|
||||
range.start.column = range.end.column = 0;
|
||||
range.end.row++;
|
||||
editor.selection.setRange(range, false);
|
||||
},
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "joinlines",
|
||||
bindKey: bindKey(null, null),
|
||||
exec: function(editor) {
|
||||
var isBackwards = editor.selection.isBackwards();
|
||||
var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();
|
||||
var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();
|
||||
var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length
|
||||
var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());
|
||||
var selectedCount = selectedText.replace(/\n\s*/, " ").length;
|
||||
var insertLine = editor.session.doc.getLine(selectionStart.row);
|
||||
|
||||
for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) {
|
||||
var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i)));
|
||||
if (curLine.length !== 0) {
|
||||
curLine = " " + curLine;
|
||||
}
|
||||
insertLine += curLine;
|
||||
};
|
||||
|
||||
if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {
|
||||
// Don't insert a newline at the end of the document
|
||||
insertLine += editor.session.doc.getNewLineCharacter();
|
||||
}
|
||||
|
||||
editor.clearSelection();
|
||||
editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);
|
||||
|
||||
if (selectedCount > 0) {
|
||||
// Select the text that was previously selected
|
||||
editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);
|
||||
editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);
|
||||
} else {
|
||||
// If the joined line had something in it, start the cursor at that something
|
||||
firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol;
|
||||
editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);
|
||||
}
|
||||
},
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "invertSelection",
|
||||
bindKey: bindKey(null, null),
|
||||
exec: function(editor) {
|
||||
var endRow = editor.session.doc.getLength() - 1;
|
||||
var endCol = editor.session.doc.getLine(endRow).length;
|
||||
var ranges = editor.selection.rangeList.ranges;
|
||||
var newRanges = [];
|
||||
|
||||
// If multiple selections don't exist, rangeList will return 0 so replace with single range
|
||||
if (ranges.length < 1) {
|
||||
ranges = [editor.selection.getRange()];
|
||||
}
|
||||
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
if (i == (ranges.length - 1)) {
|
||||
// The last selection must connect to the end of the document, unless it already does
|
||||
if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) {
|
||||
newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol));
|
||||
}
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
// The first selection must connect to the start of the document, unless it already does
|
||||
if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) {
|
||||
newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column));
|
||||
}
|
||||
} else {
|
||||
newRanges.push(new Range(ranges[i-1].end.row, ranges[i-1].end.column, ranges[i].start.row, ranges[i].start.column));
|
||||
}
|
||||
}
|
||||
|
||||
editor.exitMultiSelectMode();
|
||||
editor.clearSelection();
|
||||
|
||||
for(var i = 0; i < newRanges.length; i++) {
|
||||
editor.selection.addRange(newRanges[i], false);
|
||||
}
|
||||
},
|
||||
readOnly: true,
|
||||
scrollIntoView: "none"
|
||||
}];
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -80,6 +80,11 @@ exports.defaultCommands = [{
|
|||
name: "alignCursors",
|
||||
exec: function(editor) { editor.alignCursors(); },
|
||||
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
|
||||
}, {
|
||||
name: "findAll",
|
||||
exec: function(editor) { editor.findAll(); },
|
||||
bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
|
||||
readonly: true
|
||||
}];
|
||||
|
||||
// commands active only in multiselect mode
|
||||
|
|
|
|||
|
|
@ -153,7 +153,11 @@ function init(packaged) {
|
|||
var scriptOptions = {};
|
||||
var scriptUrl = "";
|
||||
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
// Use currentScript.ownerDocument in case this file was loaded from imported document. (HTML Imports)
|
||||
var currentScript = (document.currentScript || document._currentScript ); // native or polyfill
|
||||
var currentDocument = currentScript && currentScript.ownerDocument || document;
|
||||
|
||||
var scripts = currentDocument.getElementsByTagName("script");
|
||||
for (var i=0; i<scripts.length; i++) {
|
||||
var script = scripts[i];
|
||||
|
||||
|
|
|
|||
|
|
@ -485,15 +485,15 @@ function Folding() {
|
|||
};
|
||||
|
||||
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
|
||||
if (startRow == null) {
|
||||
if (startRow == null)
|
||||
startRow = foldLine.start.row;
|
||||
if (startColumn == null)
|
||||
startColumn = 0;
|
||||
}
|
||||
|
||||
if (endRow == null) {
|
||||
if (endRow == null)
|
||||
endRow = foldLine.end.row;
|
||||
if (endColumn == null)
|
||||
endColumn = this.getLine(endRow).length;
|
||||
}
|
||||
|
||||
|
||||
// Build the textline using the FoldLine walker.
|
||||
var doc = this.doc;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
var CommandManager = require("./commands/command_manager").CommandManager;
|
||||
var defaultCommands = require("./commands/default_commands").commands;
|
||||
var config = require("./config");
|
||||
var TokenIterator = require("./token_iterator").TokenIterator;
|
||||
|
||||
/**
|
||||
* The main entry point into the Ace functionality.
|
||||
|
|
@ -210,13 +211,14 @@ var Editor = function(renderer, session) {
|
|||
}
|
||||
};
|
||||
|
||||
// TODO use property on commands instead of this
|
||||
this.$mergeableCommands = ["backspace", "del", "insertstring"];
|
||||
this.$historyTracker = function(e) {
|
||||
if (!this.$mergeUndoDeltas)
|
||||
return;
|
||||
|
||||
|
||||
var prev = this.prevOp;
|
||||
var mergeableCommands = ["backspace", "del", "insertstring"];
|
||||
var mergeableCommands = this.$mergeableCommands;
|
||||
// previous command was the same
|
||||
var shouldMerge = prev.command && (e.command.name == prev.command.name);
|
||||
if (e.command.name == "insertstring") {
|
||||
|
|
@ -535,6 +537,89 @@ var Editor = function(renderer, session) {
|
|||
}, 50);
|
||||
};
|
||||
|
||||
// todo: move to mode.getMatching
|
||||
this.$highlightTags = function() {
|
||||
var session = this.session;
|
||||
|
||||
if (this.$highlightTagPending) {
|
||||
return;
|
||||
}
|
||||
|
||||
// perform highlight async to not block the browser during navigation
|
||||
var self = this;
|
||||
this.$highlightTagPending = true;
|
||||
setTimeout(function() {
|
||||
self.$highlightTagPending = false;
|
||||
|
||||
var pos = self.getCursorPosition();
|
||||
var iterator = new TokenIterator(self.session, pos.row, pos.column);
|
||||
var token = iterator.getCurrentToken();
|
||||
|
||||
if (!token || token.type.indexOf('tag-name') === -1) {
|
||||
session.removeMarker(session.$tagHighlight);
|
||||
session.$tagHighlight = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var tag = token.value;
|
||||
var depth = 0;
|
||||
var prevToken = iterator.stepBackward();
|
||||
|
||||
if (prevToken.value == '<'){
|
||||
//find closing tag
|
||||
do {
|
||||
prevToken = token;
|
||||
token = iterator.stepForward();
|
||||
|
||||
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
||||
if (prevToken.value==='<'){
|
||||
depth++;
|
||||
} else if (prevToken.value==='</'){
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
} while (token && depth>=0);
|
||||
}else{
|
||||
//find opening tag
|
||||
do {
|
||||
token = prevToken;
|
||||
prevToken = iterator.stepBackward();
|
||||
|
||||
if(token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
||||
if (prevToken.value==='<') {
|
||||
depth++;
|
||||
} else if( prevToken.value==='</') {
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
} while (prevToken && depth<=0);
|
||||
|
||||
//select tag again
|
||||
iterator.stepForward();
|
||||
}
|
||||
|
||||
if (!token) {
|
||||
session.removeMarker(session.$tagHighlight);
|
||||
session.$tagHighlight = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var row = iterator.getCurrentTokenRow();
|
||||
var column = iterator.getCurrentTokenColumn();
|
||||
var range = new Range(row, column, row, column+token.value.length);
|
||||
|
||||
//remove range if different
|
||||
if (session.$tagHighlight && range.compareRange(session.$backMarkers[session.$tagHighlight].range)!==0) {
|
||||
session.removeMarker(session.$tagHighlight);
|
||||
session.$tagHighlight = null;
|
||||
}
|
||||
|
||||
if (range && !session.$tagHighlight)
|
||||
session.$tagHighlight = session.addMarker(range, "ace_bracket", "text");
|
||||
}, 50);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Brings the current `textInput` into focus.
|
||||
|
|
@ -645,6 +730,7 @@ var Editor = function(renderer, session) {
|
|||
}
|
||||
|
||||
this.$highlightBrackets();
|
||||
this.$highlightTags();
|
||||
this.$updateHighlightActiveLine();
|
||||
this._signal("changeSelection");
|
||||
};
|
||||
|
|
@ -1901,24 +1987,157 @@ var Editor = function(renderer, session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Moves the cursor's row and column to the next matching bracket.
|
||||
* Moves the cursor's row and column to the next matching bracket or HTML tag.
|
||||
*
|
||||
**/
|
||||
this.jumpToMatching = function(select) {
|
||||
var cursor = this.getCursorPosition();
|
||||
var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
|
||||
var prevToken = iterator.getCurrentToken();
|
||||
var token = prevToken;
|
||||
|
||||
var range = this.session.getBracketRange(cursor);
|
||||
if (!range) {
|
||||
range = this.find({
|
||||
needle: /[{}()\[\]]/g,
|
||||
preventScroll:true,
|
||||
start: {row: cursor.row, column: cursor.column - 1}
|
||||
});
|
||||
if (!range)
|
||||
if (!token)
|
||||
token = iterator.stepForward();
|
||||
|
||||
if (!token)
|
||||
return;
|
||||
|
||||
//get next closing tag or bracket
|
||||
var matchType;
|
||||
var found = false;
|
||||
var depth = {};
|
||||
var i = cursor.column - token.start;
|
||||
var bracketType;
|
||||
var brackets = {
|
||||
")": "(",
|
||||
"(": "(",
|
||||
"]": "[",
|
||||
"[": "[",
|
||||
"{": "{",
|
||||
"}": "{"
|
||||
};
|
||||
|
||||
do {
|
||||
if (token.value.match(/[{}()\[\]]/g)) {
|
||||
for (; i<token.value.length && !found; i++) {
|
||||
if (!brackets[token.value[i]]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bracketType = brackets[token.value[i]]+'.'+token.type.replace("rparen", "lparen");
|
||||
|
||||
if (isNaN(depth[bracketType])) {
|
||||
depth[bracketType] = 0;
|
||||
}
|
||||
|
||||
switch (token.value[i]) {
|
||||
case '(':
|
||||
case '[':
|
||||
case '{':
|
||||
depth[bracketType]++;
|
||||
break;
|
||||
case ')':
|
||||
case ']':
|
||||
case '}':
|
||||
depth[bracketType]--;
|
||||
|
||||
if (depth[bracketType]===-1) {
|
||||
matchType = 'bracket';
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (token && token.type.indexOf('tag-name') !== -1) {
|
||||
if (isNaN(depth[token.value])) {
|
||||
depth[token.value] = 0;
|
||||
}
|
||||
|
||||
if (prevToken.value === '<') {
|
||||
depth[token.value]++;
|
||||
} else if (prevToken.value === '</') {
|
||||
depth[token.value]--;
|
||||
}
|
||||
|
||||
if (depth[token.value] === -1) {
|
||||
matchType = 'tag';
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
prevToken = token;
|
||||
token = iterator.stepForward();
|
||||
i = 0;
|
||||
}
|
||||
} while (token && !found);
|
||||
|
||||
//no match found
|
||||
if (!matchType) {
|
||||
return;
|
||||
}
|
||||
|
||||
var range;
|
||||
if (matchType==='bracket') {
|
||||
range = this.session.getBracketRange(cursor);
|
||||
if (!range) {
|
||||
range = new Range(
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()+i-1,
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()+i-1
|
||||
);
|
||||
if (!range)
|
||||
return;
|
||||
var pos = range.start;
|
||||
if (pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
||||
range = this.session.getBracketRange(pos);
|
||||
}
|
||||
} else if(matchType==='tag') {
|
||||
if (token && token.type.indexOf('tag-name') !== -1)
|
||||
var tag = token.value;
|
||||
else
|
||||
return;
|
||||
var pos = range.start;
|
||||
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
||||
range = this.session.getBracketRange(pos);
|
||||
|
||||
var range = new Range(
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()-2,
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()-2
|
||||
);
|
||||
|
||||
//find matching tag
|
||||
if (range.compare(cursor.row, cursor.column) === 0) {
|
||||
found = false;
|
||||
do {
|
||||
token = prevToken;
|
||||
prevToken = iterator.stepBackward();
|
||||
|
||||
if (prevToken) {
|
||||
if (prevToken.type.indexOf('tag-close') !== -1) {
|
||||
range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn()+1);
|
||||
}
|
||||
|
||||
if (token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
||||
if (prevToken.value === '<') {
|
||||
depth[tag]++;
|
||||
} else if ( prevToken.value === '</') {
|
||||
depth[tag]--;
|
||||
}
|
||||
|
||||
if (depth[tag]===0)
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
} while (prevToken && !found);
|
||||
}
|
||||
|
||||
//we found it
|
||||
if (token && token.type.indexOf('tag-name')) {
|
||||
var pos = range.start;
|
||||
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
||||
pos = range.end;
|
||||
}
|
||||
}
|
||||
|
||||
pos = range && range.cursor || pos;
|
||||
|
|
@ -2349,8 +2568,9 @@ var Editor = function(renderer, session) {
|
|||
var cursorLayer = this.renderer.$cursorLayer;
|
||||
if (!cursorLayer)
|
||||
return;
|
||||
cursorLayer.setSmoothBlinking(style == "smooth");
|
||||
cursorLayer.setSmoothBlinking(/smooth/.test(style));
|
||||
cursorLayer.isBlinking = !this.$readOnly && style != "wide";
|
||||
dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
|
||||
};
|
||||
|
||||
}).call(Editor.prototype);
|
||||
|
|
@ -2375,7 +2595,8 @@ config.defineOptions(Editor.prototype, "editor", {
|
|||
},
|
||||
readOnly: {
|
||||
set: function(readOnly) {
|
||||
this.textInput.setReadOnly(readOnly);
|
||||
// disabled to not break vim mode!
|
||||
// this.textInput.setReadOnly(readOnly);
|
||||
this.$resetCursorStyle();
|
||||
},
|
||||
initialValue: false
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ exports.runEmmetCommand = function(editor) {
|
|||
} catch(e) {
|
||||
editor._signal("changeStatus", typeof e == "string" ? e : e.message);
|
||||
console.log(e);
|
||||
result = false
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,6 +72,11 @@ exports.addCompleter = function(completer) {
|
|||
completers.push(completer);
|
||||
};
|
||||
|
||||
// Exports existing completer so that user can construct his own set of completers.
|
||||
exports.textCompleter = textCompleter;
|
||||
exports.keyWordCompleter = keyWordCompleter;
|
||||
exports.snippetCompleter = snippetCompleter;
|
||||
|
||||
var expandSnippet = {
|
||||
name: "expandSnippet",
|
||||
exec: function(editor) {
|
||||
|
|
@ -79,7 +84,7 @@ var expandSnippet = {
|
|||
if (!success)
|
||||
editor.execCommand("indent");
|
||||
},
|
||||
bindKey: "tab"
|
||||
bindKey: "Tab"
|
||||
};
|
||||
|
||||
var onChangeMode = function(e, editor) {
|
||||
|
|
@ -103,8 +108,9 @@ var loadSnippetFile = function(id) {
|
|||
config.loadModule(snippetFilePath, function(m) {
|
||||
if (m) {
|
||||
snippetManager.files[id] = m;
|
||||
m.snippets = snippetManager.parseSnippetFile(m.snippetText);
|
||||
snippetManager.register(m.snippets, m.scope);
|
||||
if (!m.snippets && m.snippetText)
|
||||
m.snippets = snippetManager.parseSnippetFile(m.snippetText);
|
||||
snippetManager.register(m.snippets || [], m.scope);
|
||||
if (m.includeScopes) {
|
||||
snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
|
||||
m.includeScopes.forEach(function(x) {
|
||||
|
|
@ -115,55 +121,51 @@ var loadSnippetFile = function(id) {
|
|||
});
|
||||
};
|
||||
|
||||
function getCompletionPrefix(editor) {
|
||||
var pos = editor.getCursorPosition();
|
||||
var line = editor.session.getLine(pos.row);
|
||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||
// Try to find custom prefixes on the completers
|
||||
editor.completers.forEach(function(completer) {
|
||||
if (completer.identifierRegexps) {
|
||||
completer.identifierRegexps.forEach(function(identifierRegex) {
|
||||
if (!prefix && identifierRegex)
|
||||
prefix = util.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
|
||||
});
|
||||
}
|
||||
});
|
||||
return prefix;
|
||||
}
|
||||
|
||||
var doLiveAutocomplete = function(e) {
|
||||
var editor = e.editor;
|
||||
var session = editor.getSession();
|
||||
var pos = editor.getCursorPosition();
|
||||
var line = session.getLine(pos.row);
|
||||
var hasCompleter = (editor.completer && editor.completer.activated);
|
||||
|
||||
var text = e.args || "";
|
||||
var hasCompleter = editor.completer && editor.completer.activated;
|
||||
|
||||
|
||||
// Is the user entering text
|
||||
// we only want to automatically show the autocomplete dialog
|
||||
// whenever the user is typing in text not pasting, deleting, ...
|
||||
var typing = (e.command.name === "insertstring" && text.length === 1);
|
||||
|
||||
// We don't want to autocomplete with no prefix
|
||||
if(
|
||||
e.command.name === 'backspace' &&
|
||||
util.retrievePrecedingIdentifier(line, pos.column) === ''
|
||||
) {
|
||||
if(hasCompleter) editor.completer.detach();
|
||||
return;
|
||||
if (e.command.name === "backspace") {
|
||||
if (hasCompleter && !getCompletionPrefix(editor))
|
||||
editor.completer.detach();
|
||||
}
|
||||
|
||||
// we don't want to autocomplete on paste events
|
||||
if(!typing) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The prefix to autocomplete for
|
||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||
|
||||
// Only autocomplete if there's a prefix that can be matched
|
||||
if(prefix !== '' && !(hasCompleter)) {
|
||||
if (!editor.completer) {
|
||||
// Create new autocompleter
|
||||
editor.completer = new Autocomplete();
|
||||
|
||||
else if (e.command.name === "insertstring") {
|
||||
var prefix = getCompletionPrefix(editor);
|
||||
// Only autocomplete if there's a prefix that can be matched
|
||||
if (prefix && !hasCompleter) {
|
||||
if (!editor.completer) {
|
||||
// Create new autocompleter
|
||||
editor.completer = new Autocomplete();
|
||||
}
|
||||
// Disable autoInsert
|
||||
editor.completer.autoSelect = false;
|
||||
editor.completer.autoInsert = false;
|
||||
editor.completer.showPopup(editor);
|
||||
} else if (!prefix && hasCompleter) {
|
||||
// When the prefix is empty
|
||||
// close the autocomplete dialog
|
||||
editor.completer.detach();
|
||||
}
|
||||
|
||||
editor.completer.showPopup(editor);
|
||||
// needed for firefox on mac
|
||||
editor.completer.cancelContextMenu();
|
||||
|
||||
} else if(prefix === '' && hasCompleter) {
|
||||
// When the prefix is empty
|
||||
// close the autocomplete dialog
|
||||
editor.completer.detach();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -172,7 +174,8 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
|||
enableBasicAutocompletion: {
|
||||
set: function(val) {
|
||||
if (val) {
|
||||
this.completers = completers;
|
||||
if (!this.completers)
|
||||
this.completers = Array.isArray(val)? val: completers;
|
||||
this.commands.addCommand(Autocomplete.startCommand);
|
||||
} else {
|
||||
this.commands.removeCommand(Autocomplete.startCommand);
|
||||
|
|
@ -180,9 +183,15 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
|||
},
|
||||
value: false
|
||||
},
|
||||
enableLiveAutocomplete: {
|
||||
/**
|
||||
* Enable live autocomplete. If the value is an array, it is assumed to be an array of completers
|
||||
* and will use them instead of the default completers.
|
||||
*/
|
||||
enableLiveAutocompletion: {
|
||||
set: function(val) {
|
||||
if (val) {
|
||||
if (!this.completers)
|
||||
this.completers = Array.isArray(val)? val: completers;
|
||||
// On each change automatically trigger the autocomplete
|
||||
this.commands.on('afterExec', doLiveAutocomplete);
|
||||
} else {
|
||||
|
|
@ -205,5 +214,4 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
|||
value: false
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
78
lib/ace/ext/linking.js
Normal file
78
lib/ace/ext/linking.js
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Editor = require("ace/editor").Editor;
|
||||
|
||||
require("../config").defineOptions(Editor.prototype, "editor", {
|
||||
enableLinking: {
|
||||
set: function(val) {
|
||||
if (val) {
|
||||
this.on("click", onClick);
|
||||
this.on("mousemove", onMouseMove);
|
||||
} else {
|
||||
this.off("click", onClick);
|
||||
this.off("mousemove", onMouseMove);
|
||||
}
|
||||
},
|
||||
value: false
|
||||
}
|
||||
})
|
||||
|
||||
function onMouseMove(e) {
|
||||
var editor = e.editor;
|
||||
var ctrl = e.getAccelKey();
|
||||
|
||||
if (ctrl) {
|
||||
var editor = e.editor;
|
||||
var docPos = e.getDocumentPosition();
|
||||
var session = editor.session;
|
||||
var token = session.getTokenAt(docPos.row, docPos.column);
|
||||
|
||||
editor._emit("linkHover", {position: docPos, token: token});
|
||||
}
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
var ctrl = e.getAccelKey();
|
||||
var button = e.getButton();
|
||||
|
||||
if (button == 0 && ctrl) {
|
||||
var editor = e.editor;
|
||||
var docPos = e.getDocumentPosition();
|
||||
var session = editor.session;
|
||||
var token = session.getTokenAt(docPos.row, docPos.column);
|
||||
|
||||
editor._emit("linkClick", {position: docPos, token: token});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -60,41 +60,47 @@ module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
|
|||
var modelist = require('../modelist');
|
||||
var themelist = require('../themelist');
|
||||
editor.menuOptions = {
|
||||
"setNewLineMode" : [{
|
||||
"textContent" : "unix",
|
||||
"value" : "unix"
|
||||
setNewLineMode: [{
|
||||
textContent: "unix",
|
||||
value: "unix"
|
||||
}, {
|
||||
"textContent" : "windows",
|
||||
"value" : "windows"
|
||||
textContent: "windows",
|
||||
value: "windows"
|
||||
}, {
|
||||
"textContent" : "auto",
|
||||
"value" : "auto"
|
||||
textContent: "auto",
|
||||
value: "auto"
|
||||
}],
|
||||
"setTheme" : [],
|
||||
"setMode" : [],
|
||||
"setKeyboardHandler": [{
|
||||
"textContent" : "ace",
|
||||
"value" : ""
|
||||
setTheme: [],
|
||||
setMode: [],
|
||||
setKeyboardHandler: [{
|
||||
textContent: "ace",
|
||||
value: ""
|
||||
}, {
|
||||
"textContent" : "vim",
|
||||
"value" : "ace/keyboard/vim"
|
||||
textContent: "vim",
|
||||
value: "ace/keyboard/vim"
|
||||
}, {
|
||||
"textContent" : "emacs",
|
||||
"value" : "ace/keyboard/emacs"
|
||||
textContent: "emacs",
|
||||
value: "ace/keyboard/emacs"
|
||||
}, {
|
||||
textContent: "textarea",
|
||||
value: "ace/keyboard/textarea"
|
||||
}, {
|
||||
textContent: "sublime",
|
||||
value: "ace/keyboard/sublime"
|
||||
}]
|
||||
};
|
||||
|
||||
editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
|
||||
return {
|
||||
'textContent' : theme.caption,
|
||||
'value' : theme.theme
|
||||
textContent: theme.caption,
|
||||
value: theme.theme
|
||||
};
|
||||
});
|
||||
|
||||
editor.menuOptions.setMode = modelist.modes.map(function(mode) {
|
||||
return {
|
||||
'textContent' : mode.name,
|
||||
'value' : mode.mode
|
||||
textContent: mode.name,
|
||||
value: mode.mode
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ var supportedModes = {
|
|||
C9Search: ["c9search_results"],
|
||||
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
|
||||
Cirru: ["cirru|cr"],
|
||||
Clojure: ["clj"],
|
||||
Clojure: ["clj|cljs"],
|
||||
Cobol: ["CBL|COB"],
|
||||
coffee: ["coffee|cf|cson|^Cakefile"],
|
||||
ColdFusion: ["cfm"],
|
||||
|
|
@ -63,6 +63,7 @@ var supportedModes = {
|
|||
D: ["d|di"],
|
||||
Dart: ["dart"],
|
||||
Diff: ["diff|patch"],
|
||||
Dockerfile: ["^Dockerfile"],
|
||||
Dot: ["dot"],
|
||||
Erlang: ["erl|hrl"],
|
||||
EJS: ["ejs"],
|
||||
|
|
@ -142,6 +143,7 @@ var supportedModes = {
|
|||
Toml: ["toml"],
|
||||
Twig: ["twig"],
|
||||
Typescript: ["ts|typescript|str"],
|
||||
Vala: ["vala"],
|
||||
VBScript: ["vbs"],
|
||||
Velocity: ["vm"],
|
||||
Verilog: ["v|vh|sv|svh"],
|
||||
|
|
|
|||
|
|
@ -103,6 +103,12 @@ patch(
|
|||
}"
|
||||
);
|
||||
|
||||
patch(
|
||||
require("../mode/text").Mode.prototype, "getTokenizer",
|
||||
/Tokenizer/,
|
||||
"TokenizerModule.Tokenizer"
|
||||
);
|
||||
|
||||
useragent.isOldIE = true;
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ var highlight = function(el, opts, callback) {
|
|||
*/
|
||||
|
||||
highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
|
||||
var waiting = 0;
|
||||
var waiting = 1;
|
||||
var modeCache = EditSession.prototype.$modes;
|
||||
|
||||
// if either the theme or the mode were specified as objects
|
||||
|
|
@ -127,7 +127,7 @@ highlight.render = function(input, mode, theme, lineStart, disableGutter, callba
|
|||
var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);
|
||||
return callback ? callback(result) : result;
|
||||
}
|
||||
return waiting || done();
|
||||
return --waiting || done();
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ function setupContainer(element, getValue) {
|
|||
return container;
|
||||
}
|
||||
|
||||
exports.transformTextarea = function(element, loader) {
|
||||
exports.transformTextarea = function(element, options) {
|
||||
var session;
|
||||
var container = setupContainer(element, function() {
|
||||
return session.getValue();
|
||||
|
|
@ -215,9 +215,8 @@ exports.transformTextarea = function(element, loader) {
|
|||
applyStyles(settingDiv, settingDivStyles);
|
||||
container.appendChild(settingDiv);
|
||||
|
||||
options = options || exports.defaultOptions;
|
||||
// Power up ace on the textarea:
|
||||
var options = {};
|
||||
|
||||
var editor = ace.edit(editorDiv);
|
||||
session = editor.getSession();
|
||||
|
||||
|
|
@ -228,10 +227,10 @@ exports.transformTextarea = function(element, loader) {
|
|||
container.appendChild(settingOpener);
|
||||
|
||||
// Create the API.
|
||||
setupApi(editor, editorDiv, settingDiv, ace, options, loader);
|
||||
setupApi(editor, editorDiv, settingDiv, ace, options, load);
|
||||
|
||||
// Create the setting's panel.
|
||||
setupSettingPanel(settingDiv, settingOpener, editor, options);
|
||||
setupSettingPanel(settingDiv, settingOpener, editor);
|
||||
|
||||
var state = "";
|
||||
event.addListener(settingOpener, "mousemove", function(e) {
|
||||
|
|
@ -296,37 +295,15 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
|
|||
};
|
||||
|
||||
editor.$setOption = editor.setOption;
|
||||
editor.$getOption = editor.getOption;
|
||||
editor.setOption = function(key, value) {
|
||||
if (options[key] == value) return;
|
||||
|
||||
switch (key) {
|
||||
case "mode":
|
||||
if (value != "text") {
|
||||
// Load the required mode file. Files get loaded only once.
|
||||
loader("mode-" + value + ".js", "ace/mode/" + value, function() {
|
||||
var aceMode = require("../mode/" + value).Mode;
|
||||
session.setMode(new aceMode());
|
||||
});
|
||||
} else {
|
||||
session.setMode(new (require("../mode/text").Mode));
|
||||
}
|
||||
editor.$setOption("mode", "ace/mode/" + value)
|
||||
break;
|
||||
|
||||
case "theme":
|
||||
if (value != "textmate") {
|
||||
// Load the required theme file. Files get loaded only once.
|
||||
loader("theme-" + value + ".js", "ace/theme/" + value, function() {
|
||||
editor.setTheme("ace/theme/" + value);
|
||||
});
|
||||
} else {
|
||||
editor.setTheme("ace/theme/textmate");
|
||||
}
|
||||
editor.$setOption("theme", "ace/theme/" + value)
|
||||
break;
|
||||
|
||||
case "fontSize":
|
||||
editorDiv.style.fontSize = value;
|
||||
break;
|
||||
|
||||
case "keybindings":
|
||||
switch (value) {
|
||||
case "vim":
|
||||
|
|
@ -341,58 +318,55 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
|
|||
break;
|
||||
|
||||
case "softWrap":
|
||||
switch (value) {
|
||||
case "off":
|
||||
session.setUseWrapMode(false);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "40":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(40, 40);
|
||||
renderer.setPrintMarginColumn(40);
|
||||
break;
|
||||
case "80":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(80, 80);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "free":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(null, null);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
}
|
||||
case "fontSize":
|
||||
editor.$setOption(key, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
editor.$setOption(key, toBool(value));
|
||||
}
|
||||
|
||||
options[key] = value;
|
||||
};
|
||||
|
||||
editor.getOption = function(key) {
|
||||
return options[key];
|
||||
switch (key) {
|
||||
case "mode":
|
||||
return editor.$getOption("mode").substr("ace/mode/".length)
|
||||
break;
|
||||
|
||||
case "theme":
|
||||
return editor.$getOption("theme").substr("ace/theme/".length)
|
||||
break;
|
||||
|
||||
case "keybindings":
|
||||
var value = editor.getKeyboardHandler()
|
||||
switch (value && value.$id) {
|
||||
case "ace/keyboard/vim":
|
||||
return "vim";
|
||||
case "ace/keyboard/emacs":
|
||||
return "emacs";
|
||||
default:
|
||||
return "ace";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return editor.$getOption(key);
|
||||
}
|
||||
};
|
||||
|
||||
editor.getOptions = function() {
|
||||
return options;
|
||||
};
|
||||
|
||||
editor.setOptions(exports.options);
|
||||
|
||||
editor.setOptions(options);
|
||||
return editor;
|
||||
}
|
||||
|
||||
function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
||||
function setupSettingPanel(settingDiv, settingOpener, editor) {
|
||||
var BOOL = null;
|
||||
|
||||
var desc = {
|
||||
mode: "Mode:",
|
||||
gutter: "Display Gutter:",
|
||||
wrap: "Soft Wrap:",
|
||||
theme: "Theme:",
|
||||
fontSize: "Font Size:",
|
||||
softWrap: "Soft Wrap:",
|
||||
showGutter: "Display Gutter:",
|
||||
keybindings: "Keyboard",
|
||||
showPrintMargin: "Show Print Margin:",
|
||||
useSoftTabs: "Use Soft Tabs:",
|
||||
|
|
@ -445,7 +419,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
|||
twilight: "Twilight",
|
||||
vibrant_ink: "Vibrant Ink"
|
||||
},
|
||||
gutter: BOOL,
|
||||
showGutter: BOOL,
|
||||
fontSize: {
|
||||
"10px": "10px",
|
||||
"11px": "11px",
|
||||
|
|
@ -453,7 +427,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
|||
"14px": "14px",
|
||||
"16px": "16px"
|
||||
},
|
||||
softWrap: {
|
||||
wrap: {
|
||||
off: "Off",
|
||||
40: "40",
|
||||
80: "80",
|
||||
|
|
@ -476,7 +450,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
|||
if (!obj) {
|
||||
builder.push(
|
||||
"<input type='checkbox' title='", option, "' ",
|
||||
cValue == "true" ? "checked='true'" : "",
|
||||
cValue + "" == "true" ? "checked='true'" : "",
|
||||
"'></input>"
|
||||
);
|
||||
return;
|
||||
|
|
@ -496,10 +470,10 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
|||
builder.push("</select>");
|
||||
}
|
||||
|
||||
for (var option in options) {
|
||||
for (var option in exports.defaultOptions) {
|
||||
table.push("<tr><td>", desc[option], "</td>");
|
||||
table.push("<td>");
|
||||
renderOption(table, option, optionValues[option], options[option]);
|
||||
renderOption(table, option, optionValues[option], editor.getOption(option));
|
||||
table.push("</td></tr>");
|
||||
}
|
||||
table.push("</table>");
|
||||
|
|
@ -532,12 +506,12 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
|||
}
|
||||
|
||||
// Default startup options.
|
||||
exports.options = {
|
||||
mode: "text",
|
||||
exports.defaultOptions = {
|
||||
mode: "javascript",
|
||||
theme: "textmate",
|
||||
gutter: "false",
|
||||
wrap: "off",
|
||||
fontSize: "12px",
|
||||
softWrap: "off",
|
||||
showGutter: "false",
|
||||
keybindings: "ace",
|
||||
showPrintMargin: "false",
|
||||
useSoftTabs: "true",
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
require("ace/lib/fixoldbrowsers");
|
||||
|
||||
var themeData = [
|
||||
["Chrome" ],
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ exports.$detectIndentation = function(lines, fallback) {
|
|||
if (!/^\s*[^*+\-\s]/.test(line))
|
||||
continue;
|
||||
|
||||
var tabs = line.match(/^\t*/)[0].length;
|
||||
if (line[0] == "\t")
|
||||
tabIndents++;
|
||||
|
||||
|
|
@ -65,9 +64,6 @@ exports.$detectIndentation = function(lines, fallback) {
|
|||
line = lines[i++];
|
||||
}
|
||||
|
||||
if (!stats.length)
|
||||
return;
|
||||
|
||||
function getScore(indent) {
|
||||
var score = 0;
|
||||
for (var i = indent; i < stats.length; i += indent)
|
||||
|
|
@ -82,13 +78,12 @@ exports.$detectIndentation = function(lines, fallback) {
|
|||
for (var i = 1; i < 12; i++) {
|
||||
if (i == 1) {
|
||||
spaceIndents = getScore(i);
|
||||
var score = 1;
|
||||
var score = stats.length && 1;
|
||||
} else
|
||||
var score = getScore(i) / spaceIndents;
|
||||
|
||||
if (changes[i]) {
|
||||
if (changes[i])
|
||||
score += changes[i] / changesTotal;
|
||||
}
|
||||
|
||||
if (score > first.score)
|
||||
first = {score: score, length: i};
|
||||
|
|
@ -100,7 +95,7 @@ exports.$detectIndentation = function(lines, fallback) {
|
|||
if (tabIndents > spaceIndents + 1)
|
||||
return {ch: "\t", length: tabLength};
|
||||
|
||||
if (spaceIndents + 1 > tabIndents)
|
||||
if (spaceIndents > tabIndents + 1)
|
||||
return {ch: " ", length: tabLength};
|
||||
};
|
||||
|
||||
|
|
|
|||
116
lib/ace/ext/whitespace_test.js
Normal file
116
lib/ace/ext/whitespace_test.js
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
require("../test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var assert = require("assert");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var whitespace = require("./whitespace");
|
||||
|
||||
// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
|
||||
module.exports = {
|
||||
timeout: 10000,
|
||||
|
||||
"test tab detection": function(next) {
|
||||
var s = new EditSession([
|
||||
"define({",
|
||||
"\tfoo:1,",
|
||||
"\tbar:2,",
|
||||
"\tbaz:{,",
|
||||
"\t\tx:3",
|
||||
"\t}",
|
||||
"})"
|
||||
]);
|
||||
|
||||
var indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
assert.equal(indent.ch, "\t");
|
||||
assert.equal(indent.length, undefined);
|
||||
|
||||
s.insert({row: 0, column: 0}, " ");
|
||||
indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
assert.equal(indent.ch, "\t");
|
||||
assert.equal(indent.length, 4);
|
||||
|
||||
s.setValue("");
|
||||
indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
assert.ok(!indent);
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
"test empty session": function(next) {
|
||||
var s = new EditSession([
|
||||
"define({",
|
||||
"foo:1,",
|
||||
"})"
|
||||
]);
|
||||
var indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
assert.ok(!indent);
|
||||
s.insert({row: 1, column: 0}, " x\n ");
|
||||
|
||||
indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
assert.equal(indent.ch, " ");
|
||||
assert.equal(indent.length, 4);
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
"!test one line": function(next) {
|
||||
var s = new EditSession([
|
||||
"define({",
|
||||
" foo:1,",
|
||||
"})"
|
||||
]);
|
||||
var indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
assert.equal(indent.ch, " ");
|
||||
assert.equal(indent.length, 4);
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
"test 1 width indents": function(next) {
|
||||
var s = new EditSession([
|
||||
"define({",
|
||||
" foo:1,",
|
||||
"})",
|
||||
"define({",
|
||||
" bar:1,",
|
||||
"})",
|
||||
" t",
|
||||
" t",
|
||||
" t",
|
||||
" t",
|
||||
" t",
|
||||
" t",
|
||||
" t",
|
||||
" t"
|
||||
]);
|
||||
var indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
// assert.equal(indent.ch, " ");
|
||||
// assert.equal(indent.length, 4);
|
||||
|
||||
s = new EditSession([
|
||||
"{",
|
||||
" foo:1,",
|
||||
" bar: {",
|
||||
" baz:2",
|
||||
" }",
|
||||
"}"
|
||||
]);
|
||||
indent = whitespace.$detectIndentation(s.doc.$lines);
|
||||
assert.equal(indent.ch, " ");
|
||||
assert.equal(indent.length, 1);
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ var event = require("../lib/event");
|
|||
|
||||
var KeyBinding = function(editor) {
|
||||
this.$editor = editor;
|
||||
this.$data = {};
|
||||
this.$data = {editor: editor};
|
||||
this.$handlers = [];
|
||||
this.setDefaultHandler(editor.commands);
|
||||
};
|
||||
|
|
@ -46,7 +46,6 @@ var KeyBinding = function(editor) {
|
|||
this.removeKeyboardHandler(this.$defaultHandler);
|
||||
this.$defaultHandler = kb;
|
||||
this.addKeyboardHandler(kb, 0);
|
||||
this.$data = {editor: this.$editor};
|
||||
};
|
||||
|
||||
this.setKeyboardHandler = function(kb) {
|
||||
|
|
|
|||
82
lib/ace/keyboard/textarea.js
Normal file
82
lib/ace/keyboard/textarea.js
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var HashHandler = require("./hash_handler").HashHandler;
|
||||
exports.handler = new HashHandler();
|
||||
|
||||
[{
|
||||
bindKey: "Shift-Tab|Tab",
|
||||
command: "passKeysToBrowser"
|
||||
}, {
|
||||
bindKey: {win: "Ctrl-L", mac: "Cmd-L"},
|
||||
command: "passKeysToBrowser"
|
||||
}, {
|
||||
bindKey: {win: "Ctrl-G", mac: "Cmd-G"},
|
||||
command: "gotoline"
|
||||
}, {
|
||||
bindKey: {win: "Ctrl-T|Ctrl-Shift-T", mac: "Cmd-T|Cmd-Shift-T"},
|
||||
command: "passKeysToBrowser"
|
||||
}, {
|
||||
bindKey: {win: "Ctrl-G", mac: "Cmd-G"},
|
||||
command: "passKeysToBrowser"
|
||||
}, {
|
||||
bindKey: {win: "Ctrl-G", mac: "Cmd-G"},
|
||||
command: "passKeysToBrowser"
|
||||
}, {
|
||||
name: "golineup",
|
||||
bindKey: {win: null, mac: "Ctrl-P"},
|
||||
}, {
|
||||
name: "golinedown",
|
||||
bindKey: {win: null, mac: "Ctrl-N"},
|
||||
}, {
|
||||
name: "gotoleft",
|
||||
bindKey: {win: null, mac: "Ctrl-B"},
|
||||
}, {
|
||||
name: "gotoright",
|
||||
bindKey: {win: null, mac: "Ctrl-F"},
|
||||
}, {
|
||||
name: "gotolineend",
|
||||
bindKey: {win: null, mac: "Ctrl-E"},
|
||||
}, {
|
||||
name: "gotolinestart",
|
||||
bindKey: {win: null, mac: "Ctrl-A"},
|
||||
}
|
||||
].forEach(function(k) {
|
||||
var bindKey = k.bindKey;
|
||||
if (typeof bindKey == "object")
|
||||
bindKey = bindKey[exports.handler.platform];
|
||||
exports.handler.bindKey(bindKey, k.command);
|
||||
});
|
||||
exports.handler.$id = "ace/keyboard/textarea";
|
||||
|
||||
});
|
||||
|
|
@ -36,6 +36,7 @@ var useragent = require("../lib/useragent");
|
|||
var dom = require("../lib/dom");
|
||||
var lang = require("../lib/lang");
|
||||
var BROKEN_SETDATA = useragent.isChrome < 18;
|
||||
var USE_IE_MIME_TYPE = useragent.isIE;
|
||||
|
||||
var TextInput = function(parentNode, host) {
|
||||
var text = dom.createElement("textarea");
|
||||
|
|
@ -54,7 +55,6 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var PLACEHOLDER = "\x01\x01";
|
||||
|
||||
var cut = false;
|
||||
var copied = false;
|
||||
var pasted = false;
|
||||
var inComposition = false;
|
||||
|
|
@ -186,9 +186,7 @@ var TextInput = function(parentNode, host) {
|
|||
}
|
||||
|
||||
var onSelect = function(e) {
|
||||
if (cut) {
|
||||
cut = false;
|
||||
} else if (copied) {
|
||||
if (copied) {
|
||||
copied = false;
|
||||
} else if (isAllSelected(text)) {
|
||||
host.selectAll();
|
||||
|
|
@ -243,55 +241,31 @@ var TextInput = function(parentNode, host) {
|
|||
sendText(data);
|
||||
resetValue();
|
||||
};
|
||||
|
||||
var onCut = function(e) {
|
||||
var data = host.getCopyText();
|
||||
if (!data) {
|
||||
event.preventDefault(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var handleClipboardData = function(e, data) {
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
|
||||
if (clipboardData && !BROKEN_SETDATA) {
|
||||
// Safari 5 has clipboardData object, but does not handle setData()
|
||||
var supported = clipboardData.setData("Text", data);
|
||||
if (supported) {
|
||||
host.onCut();
|
||||
event.preventDefault(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!supported) {
|
||||
cut = true;
|
||||
text.value = data;
|
||||
text.select();
|
||||
setTimeout(function(){
|
||||
cut = false;
|
||||
resetValue();
|
||||
resetSelection();
|
||||
host.onCut();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var onCopy = function(e) {
|
||||
var data = host.getCopyText();
|
||||
if (!data) {
|
||||
event.preventDefault(e);
|
||||
if (!clipboardData || BROKEN_SETDATA)
|
||||
return;
|
||||
}
|
||||
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
if (clipboardData && !BROKEN_SETDATA) {
|
||||
// using "Text" doesn't work on old webkit but ie needs it
|
||||
// TODO are there other browsers that require "Text"?
|
||||
var mime = USE_IE_MIME_TYPE ? "Text" : "text/plain";
|
||||
if (data) {
|
||||
// Safari 5 has clipboardData object, but does not handle setData()
|
||||
var supported = clipboardData.setData("Text", data);
|
||||
if (supported) {
|
||||
host.onCopy();
|
||||
event.preventDefault(e);
|
||||
}
|
||||
return clipboardData.setData(mime, data) !== false;
|
||||
} else {
|
||||
return clipboardData.getData(mime);
|
||||
}
|
||||
if (!supported) {
|
||||
}
|
||||
|
||||
var doCopy = function(e, isCut) {
|
||||
var data = host.getCopyText();
|
||||
if (!data)
|
||||
return event.preventDefault(e);
|
||||
|
||||
if (handleClipboardData(e, data)) {
|
||||
isCut ? host.onCut() : host.onCopy();
|
||||
event.preventDefault(e);
|
||||
} else {
|
||||
copied = true;
|
||||
text.value = data;
|
||||
text.select();
|
||||
|
|
@ -299,16 +273,22 @@ var TextInput = function(parentNode, host) {
|
|||
copied = false;
|
||||
resetValue();
|
||||
resetSelection();
|
||||
host.onCopy();
|
||||
isCut ? host.onCut() : host.onCopy();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var onCut = function(e) {
|
||||
doCopy(e, true);
|
||||
}
|
||||
|
||||
var onCopy = function(e) {
|
||||
doCopy(e, false);
|
||||
}
|
||||
|
||||
var onPaste = function(e) {
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
|
||||
if (clipboardData) {
|
||||
var data = clipboardData.getData("Text");
|
||||
var data = handleClipboardData(e);
|
||||
if (typeof data == "string") {
|
||||
if (data)
|
||||
host.onPaste(data);
|
||||
if (useragent.isIE)
|
||||
|
|
@ -336,7 +316,7 @@ var TextInput = function(parentNode, host) {
|
|||
if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
|
||||
return;
|
||||
return;
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 67:
|
||||
|
|
|
|||
|
|
@ -120,23 +120,24 @@ exports.handler = {
|
|||
return null;
|
||||
|
||||
var editor = data.editor;
|
||||
var vimState = data.vimState || "start";
|
||||
|
||||
if (hashId == 1)
|
||||
key = "ctrl-" + key;
|
||||
if (key == "ctrl-c") {
|
||||
if (!useragent.isMac && editor.getCopyText()) {
|
||||
editor.once("copy", function() {
|
||||
if (data.state == "start")
|
||||
if (vimState == "start")
|
||||
coreCommands.stop.exec(editor);
|
||||
else
|
||||
editor.selection.clearSelection();
|
||||
});
|
||||
return {command: "null", passEvent: true};
|
||||
}
|
||||
return {command: coreCommands.stop};
|
||||
return {command: coreCommands.stop};
|
||||
} else if ((key == "esc" && hashId === 0) || key == "ctrl-[") {
|
||||
return {command: coreCommands.stop};
|
||||
} else if (data.state == "start") {
|
||||
} else if (vimState == "start") {
|
||||
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
|
||||
hashId = -1;
|
||||
key = data.inputChar;
|
||||
|
|
@ -146,13 +147,16 @@ exports.handler = {
|
|||
if (cmds.inputBuffer.idle && startCommands[key])
|
||||
return startCommands[key];
|
||||
var isHandled = cmds.inputBuffer.push(editor, key);
|
||||
if (!isHandled && hashId !== -1)
|
||||
return;
|
||||
return {command: "null", passEvent: !isHandled};
|
||||
} // if no modifier || shift: wait for input.
|
||||
else if (key.length == 1 && (hashId === 0 || hashId == 4)) {
|
||||
return {command: "null", passEvent: true};
|
||||
} else if (key == "esc" && hashId === 0) {
|
||||
return {command: coreCommands.stop};
|
||||
}
|
||||
// if no modifier || shift: wait for input.
|
||||
else if (hashId === 0 || hashId == 4) {
|
||||
return {command: "null", passEvent: true};
|
||||
}
|
||||
} else {
|
||||
if (key == "ctrl-w") {
|
||||
return {command: "removewordleft"};
|
||||
|
|
|
|||
|
|
@ -123,10 +123,12 @@ var actions = exports.actions = {
|
|||
range.end.column++;
|
||||
var text = editor.session.getTextRange(range);
|
||||
var toggled = text.toUpperCase();
|
||||
if (toggled == text)
|
||||
editor.navigateRight();
|
||||
else
|
||||
if (toggled != text)
|
||||
editor.session.replace(range, toggled);
|
||||
else if (text.toLowerCase() != text)
|
||||
editor.session.replace(range, text.toLowerCase())
|
||||
else
|
||||
editor.navigateRight();
|
||||
}, count || 1);
|
||||
}
|
||||
},
|
||||
|
|
@ -164,6 +166,7 @@ var actions = exports.actions = {
|
|||
fn: function(editor, range, count, param) {
|
||||
var options = editor.getLastSearchOptions();
|
||||
options.backwards = false;
|
||||
options.start = null;
|
||||
|
||||
editor.selection.moveCursorRight();
|
||||
editor.selection.clearSelection();
|
||||
|
|
@ -180,6 +183,7 @@ var actions = exports.actions = {
|
|||
fn: function(editor, range, count, param) {
|
||||
var options = editor.getLastSearchOptions();
|
||||
options.backwards = true;
|
||||
options.start = null;
|
||||
|
||||
editor.findPrevious(options);
|
||||
ensureScrollMargin(editor);
|
||||
|
|
@ -340,6 +344,7 @@ var inputBuffer = exports.inputBuffer = {
|
|||
currentCmd: null,
|
||||
//currentMode: 0,
|
||||
currentCount: "",
|
||||
pendingCount: "",
|
||||
status: "",
|
||||
|
||||
// Types
|
||||
|
|
@ -440,8 +445,9 @@ var inputBuffer = exports.inputBuffer = {
|
|||
},
|
||||
|
||||
getCount: function() {
|
||||
var count = this.currentCount;
|
||||
var count = this.currentCount || this.pendingCount;
|
||||
this.currentCount = "";
|
||||
this.pendingCount = count;
|
||||
return count && parseInt(count, 10);
|
||||
},
|
||||
|
||||
|
|
@ -497,7 +503,8 @@ var inputBuffer = exports.inputBuffer = {
|
|||
else if (selectable) {
|
||||
repeat(function() {
|
||||
run(motionObj.sel);
|
||||
operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
|
||||
operators[o.ch].fn(editor, editor.getSelectionRange(),
|
||||
o.count, motionObj.param ? motionObj : param);
|
||||
}, o.count || 1);
|
||||
}
|
||||
this.reset();
|
||||
|
|
@ -517,6 +524,7 @@ var inputBuffer = exports.inputBuffer = {
|
|||
this.operator = null;
|
||||
this.motion = null;
|
||||
this.currentCount = "";
|
||||
this.pendingCount = "";
|
||||
this.status = "";
|
||||
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
|
||||
this.idle = true;
|
||||
|
|
|
|||
|
|
@ -350,6 +350,10 @@ module.exports = {
|
|||
case "W":
|
||||
editor.selection.selectAWord();
|
||||
break;
|
||||
case ")":
|
||||
case "}":
|
||||
case "]":
|
||||
param = editor.session.$brackets[param];
|
||||
case "(":
|
||||
case "{":
|
||||
case "[":
|
||||
|
|
@ -383,6 +387,7 @@ module.exports = {
|
|||
param: true,
|
||||
handlesCount: true,
|
||||
getPos: function(editor, range, count, param, isSel, isRepeat) {
|
||||
if (param == "space") param = " ";
|
||||
if (!isRepeat)
|
||||
LAST_SEARCH_MOTION = {ch: "f", param: param};
|
||||
var cursor = editor.getCursorPosition();
|
||||
|
|
@ -398,6 +403,7 @@ module.exports = {
|
|||
param: true,
|
||||
handlesCount: true,
|
||||
getPos: function(editor, range, count, param, isSel, isRepeat) {
|
||||
if (param == "space") param = " ";
|
||||
if (!isRepeat)
|
||||
LAST_SEARCH_MOTION = {ch: "F", param: param};
|
||||
var cursor = editor.getCursorPosition();
|
||||
|
|
@ -413,6 +419,7 @@ module.exports = {
|
|||
param: true,
|
||||
handlesCount: true,
|
||||
getPos: function(editor, range, count, param, isSel, isRepeat) {
|
||||
if (param == "space") param = " ";
|
||||
if (!isRepeat)
|
||||
LAST_SEARCH_MOTION = {ch: "t", param: param};
|
||||
var cursor = editor.getCursorPosition();
|
||||
|
|
@ -431,6 +438,7 @@ module.exports = {
|
|||
param: true,
|
||||
handlesCount: true,
|
||||
getPos: function(editor, range, count, param, isSel, isRepeat) {
|
||||
if (param == "space") param = " ";
|
||||
if (!isRepeat)
|
||||
LAST_SEARCH_MOTION = {ch: "T", param: param};
|
||||
var cursor = editor.getCursorPosition();
|
||||
|
|
@ -656,7 +664,8 @@ module.exports = {
|
|||
pos.column = line.length;
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
},
|
||||
isLine: true
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ define(function(require, exports, module) {
|
|||
|
||||
var util = require("./util");
|
||||
var registers = require("../registers");
|
||||
var Range = require("../../../range").Range;
|
||||
|
||||
module.exports = {
|
||||
"d": {
|
||||
|
|
@ -90,10 +91,15 @@ module.exports = {
|
|||
count = count || 1;
|
||||
switch (param) {
|
||||
case "c":
|
||||
for (var i = 0; i < count; i++) {
|
||||
editor.removeLines();
|
||||
util.insertMode(editor);
|
||||
}
|
||||
editor.$blockScrolling++;
|
||||
editor.selection.$moveSelection(function() {
|
||||
editor.selection.moveCursorBy(count - 1, 0);
|
||||
});
|
||||
var rows = editor.$getSelectedRows();
|
||||
range = new Range(rows.first, 0, rows.last, Infinity);
|
||||
editor.session.remove(range);
|
||||
editor.$blockScrolling--;
|
||||
util.insertMode(editor);
|
||||
break;
|
||||
default:
|
||||
if (range) {
|
||||
|
|
@ -113,6 +119,8 @@ module.exports = {
|
|||
},
|
||||
fn: function(editor, range, count, param) {
|
||||
count = count || 1;
|
||||
if (param && param.isLine)
|
||||
param = "y";
|
||||
switch (param) {
|
||||
case "y":
|
||||
var pos = editor.getCursorPosition();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ module.exports = {
|
|||
|
||||
editor.setOverwrite(false);
|
||||
editor.keyBinding.$data.buffer = "";
|
||||
editor.keyBinding.$data.state = "insertMode";
|
||||
editor.keyBinding.$data.vimState = "insertMode";
|
||||
this.onVisualMode = false;
|
||||
this.onVisualLineMode = false;
|
||||
if(this.onInsertReplaySequence) {
|
||||
|
|
@ -66,7 +66,7 @@ module.exports = {
|
|||
|
||||
editor.setOverwrite(true);
|
||||
editor.keyBinding.$data.buffer = "";
|
||||
editor.keyBinding.$data.state = "start";
|
||||
editor.keyBinding.$data.vimState = "start";
|
||||
this.onVisualMode = false;
|
||||
this.onVisualLineMode = false;
|
||||
editor._emit("changeStatus");
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ define(function(require, exports, module) {
|
|||
var oop = require("../lib/oop");
|
||||
var dom = require("../lib/dom");
|
||||
var lang = require("../lib/lang");
|
||||
var useragent = require("../lib/useragent");
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
|
||||
var CHAR_COUNT = 0;
|
||||
|
|
@ -54,7 +55,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
|
|||
|
||||
if (!CHAR_COUNT)
|
||||
this.$testFractionalRect();
|
||||
this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT);
|
||||
this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT);
|
||||
|
||||
this.$characterSize = {width: 0, height: 0};
|
||||
this.checkForSizeChanges();
|
||||
|
|
@ -85,7 +86,12 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
|
|||
style.visibility = "hidden";
|
||||
style.position = "fixed";
|
||||
style.whiteSpace = "pre";
|
||||
style.font = "inherit";
|
||||
|
||||
if (useragent.isIE < 8) {
|
||||
style["font-family"] = "inherit";
|
||||
} else {
|
||||
style.font = "inherit";
|
||||
}
|
||||
style.overflow = isRoot ? "hidden" : "visible";
|
||||
};
|
||||
|
||||
|
|
@ -121,11 +127,18 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
|
|||
};
|
||||
|
||||
this.$measureSizes = function() {
|
||||
var rect = this.$measureNode.getBoundingClientRect();
|
||||
var size = {
|
||||
height: rect.height,
|
||||
width: rect.width / CHAR_COUNT
|
||||
};
|
||||
if (CHAR_COUNT === 1) {
|
||||
var rect = this.$measureNode.getBoundingClientRect();
|
||||
var size = {
|
||||
height: rect.height,
|
||||
width: rect.width
|
||||
};
|
||||
} else {
|
||||
var size = {
|
||||
height: this.$measureNode.clientHeight,
|
||||
width: this.$measureNode.clientWidth / CHAR_COUNT
|
||||
};
|
||||
}
|
||||
// Size and width can be null if the editor is not visible or
|
||||
// detached from the document
|
||||
if (size.width === 0 || size.height === 0)
|
||||
|
|
@ -134,7 +147,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
|
|||
};
|
||||
|
||||
this.$measureCharWidth = function(ch) {
|
||||
this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT);
|
||||
this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT);
|
||||
var rect = this.$main.getBoundingClientRect();
|
||||
return rect.width / CHAR_COUNT;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ exports.preventDefault = function(e) {
|
|||
exports.getButton = function(e) {
|
||||
if (e.type == "dblclick")
|
||||
return 0;
|
||||
if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac))
|
||||
if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
|
||||
return 2;
|
||||
|
||||
// DOM Event
|
||||
|
|
@ -161,7 +161,7 @@ exports.addMouseWheelListener = function(el, callback) {
|
|||
|
||||
exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) {
|
||||
var clicks = 0;
|
||||
var startX, startY, timer;
|
||||
var startX, startY, timer;
|
||||
var eventNames = {
|
||||
2: "dblclick",
|
||||
3: "tripleclick",
|
||||
|
|
@ -180,9 +180,12 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
|||
}
|
||||
if (useragent.isIE) {
|
||||
var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
|
||||
if (isNewClick) {
|
||||
if (!timer || isNewClick)
|
||||
clicks = 1;
|
||||
}
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
|
||||
|
||||
if (clicks == 1) {
|
||||
startX = e.clientX;
|
||||
startY = e.clientY;
|
||||
|
|
@ -276,6 +279,14 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (useragent.isChromeOS && hashId & 8) {
|
||||
callback(e, hashId, keyCode);
|
||||
if (e.defaultPrevented)
|
||||
return;
|
||||
else
|
||||
hashId &= ~8;
|
||||
}
|
||||
|
||||
// If there is no hashId and the keyCode is not a function key, then
|
||||
// we don't call the callback as we don't handle a command key here
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ var Keys = (function() {
|
|||
80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
|
||||
87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
|
||||
187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[',
|
||||
220: '\\',221: ']', 222: '\'',
|
||||
220: '\\',221: ']', 222: '\''
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ var Keys = (function() {
|
|||
|
||||
// workaround for firefox bug
|
||||
ret[173] = '-';
|
||||
|
||||
|
||||
(function() {
|
||||
var mods = ["cmd", "ctrl", "alt", "shift"];
|
||||
for (var i = Math.pow(2, mods.length); i--;) {
|
||||
|
|
@ -148,7 +148,11 @@ var Keys = (function() {
|
|||
oop.mixin(exports, Keys);
|
||||
|
||||
exports.keyCodeToString = function(keyCode) {
|
||||
return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
|
||||
// Language-switching keystroke in Chrome/Linux emits keyCode 0.
|
||||
var keyString = Keys[keyCode];
|
||||
if (typeof keyString != "string")
|
||||
keyString = String.fromCharCode(keyCode);
|
||||
return keyString.toLowerCase();
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -76,15 +76,16 @@ exports.isLinux = (os == "linux");
|
|||
// Windows Store JavaScript apps (aka Metro apps written in HTML5 and JavaScript) do not use the "Microsoft Internet Explorer" string in their user agent, but "MSAppHost" instead.
|
||||
exports.isIE =
|
||||
(navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0)
|
||||
&& parseFloat(navigator.userAgent.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:|MSIE )([0-9]+[\.0-9]+)/)[1]);
|
||||
? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1])
|
||||
: parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]); // for ie
|
||||
|
||||
exports.isOldIE = exports.isIE && exports.isIE < 9;
|
||||
|
||||
// Is this Firefox or related?
|
||||
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
|
||||
exports.isGecko = exports.isMozilla = (window.Controllers || window.controllers) && window.navigator.product === "Gecko";
|
||||
|
||||
// oldGecko == rev < 2.0
|
||||
exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4;
|
||||
exports.isOldGecko = exports.isGecko && parseInt((ua.match(/rv\:(\d+)/)||[])[1], 10) < 4;
|
||||
|
||||
// Is this Opera
|
||||
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
|
||||
|
|
@ -100,4 +101,6 @@ exports.isIPad = ua.indexOf("iPad") >= 0;
|
|||
|
||||
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
|
||||
|
||||
exports.isChromeOS = ua.indexOf(" CrOS ") >= 0;
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ function LineWidgets(session) {
|
|||
|
||||
editor.widgetManager = this;
|
||||
|
||||
editor.setOption("enableLineWidgets", true);
|
||||
editor.renderer.on("beforeRender", this.measureWidgets);
|
||||
editor.renderer.on("afterRender", this.renderWidgets);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<html>
|
||||
<script a='a'>var</script>'123'
|
||||
<scripts>
|
||||
<script a='a'>var "</scripts></script>'123'
|
||||
</scripts>
|
||||
<a href="abc
|
||||
def">
|
||||
<a href='abc
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@
|
|||
["text",";"]
|
||||
],[
|
||||
"start",
|
||||
["identifier","assert"],
|
||||
["keyword.control.dart","assert"],
|
||||
["text","("],
|
||||
["identifier","unicorn"],
|
||||
["text"," "],
|
||||
|
|
@ -357,7 +357,7 @@
|
|||
["text",";"]
|
||||
],[
|
||||
"start",
|
||||
["identifier","assert"],
|
||||
["keyword.control.dart","assert"],
|
||||
["text","("],
|
||||
["identifier","iMeantToDoThis"],
|
||||
["text","."],
|
||||
|
|
|
|||
|
|
@ -4,393 +4,257 @@
|
|||
["variable"," --git"],
|
||||
["keyword"," a/lib/ace/edit_session.js"],
|
||||
["variable"," b/lib/ace/edit_session.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable","index 23fc3fc..ed3b273 100644"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant.numeric","---"],
|
||||
["meta.tag"," a/lib/ace/edit_session.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant.numeric","+++"],
|
||||
["meta.tag"," b/lib/ace/edit_session.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant","@@"],
|
||||
["constant.numeric"," -51,6 +51,7 "],
|
||||
["constant","@@"],
|
||||
["comment.doc.tag"," var TextMode = require(\"./mode/text\").Mode;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," var Range = require(\"./range\").Range;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," var Document = require(\"./document\").Document;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text","var SearchHighlight = require(\"./search_highlight\").SearchHighlight;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," /**"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," * class EditSession"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant","@@"],
|
||||
["constant.numeric"," -307,6 +308,13 "],
|
||||
["constant","@@"],
|
||||
["comment.doc.tag"," var EditSession = function(text, mode) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," return token;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," };"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," this.highlight = function(re) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," if (!this.$searchHighlight) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," this.$searchHighlight = this.addDynamicMarker(highlight);"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," }"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," this.$searchHighlight.setRegexp(re);"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," }"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," /**"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," * EditSession.setUndoManager(undoManager)"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," * - undoManager (UndoManager): The new undo manager"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant","@@"],
|
||||
["constant.numeric"," -556,7 +564,8 "],
|
||||
["constant","@@"],
|
||||
["comment.doc.tag"," var EditSession = function(text, mode) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," type : type || \"line\","]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," renderer: typeof type == \"function\" ? type : null,"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," clazz : clazz,"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," inFront: !!inFront"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," inFront: !!inFront,"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," id: id"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," }"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," if (inFront) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable","diff"],
|
||||
["variable"," --git"],
|
||||
["keyword"," a/lib/ace/editor.js"],
|
||||
["variable"," b/lib/ace/editor.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable","index 834e603..b27ec73 100644"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant.numeric","---"],
|
||||
["meta.tag"," a/lib/ace/editor.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant.numeric","+++"],
|
||||
["meta.tag"," b/lib/ace/editor.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant","@@"],
|
||||
["constant.numeric"," -494,7 +494,7 "],
|
||||
["constant","@@"],
|
||||
["comment.doc.tag"," var Editor = function(renderer, session) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," * Emitted when a selection has changed."]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," **/"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," this.onSelectionChange = function(e) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," var session = this.getSession();"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," var session = this.session;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," if (session.$selectionMarker) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," session.removeMarker(session.$selectionMarker);"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant","@@"],
|
||||
["constant.numeric"," -509,12 +509,40 "],
|
||||
["constant","@@"],
|
||||
["comment.doc.tag"," var Editor = function(renderer, session) {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," this.$updateHighlightActiveLine();"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," }"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," var self = this;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," if (this.$highlightSelectedWord && !this.$wordHighlightTimer)"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," this.$wordHighlightTimer = setTimeout(function() {"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," self.session.$mode.highlightSelection(self);"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," self.$wordHighlightTimer = null;"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function","-"],
|
||||
["string"," }, 30, this);"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text"," var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible"," };"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable","diff"],
|
||||
["variable"," --git"],
|
||||
["keyword"," a/lib/ace/search_highlight.js"],
|
||||
["variable"," b/lib/ace/search_highlight.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["invisible","new file mode 100644"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["variable","index 0000000..b2df779"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant.numeric","---"],
|
||||
["meta.tag"," /dev/null"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant.numeric","+++"],
|
||||
["meta.tag"," b/lib/ace/search_highlight.js"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["constant","@@"],
|
||||
["constant.numeric"," -0,0 +1,3 "],
|
||||
["constant","@@"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
["text","new"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.constant","+"],
|
||||
|
|
|
|||
142
lib/ace/mode/_test/tokens_gherkin.json
Normal file
142
lib/ace/mode/_test/tokens_gherkin.json
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
[[
|
||||
"start",
|
||||
["comment","@these"],
|
||||
["text"," "],
|
||||
["comment","@are"],
|
||||
["text"," "],
|
||||
["comment","@tags"]
|
||||
],[
|
||||
"start",
|
||||
["keyword","Feature:"],
|
||||
["text"," Serve coffee"]
|
||||
],[
|
||||
"start",
|
||||
["text"," Coffee should not be served until paid for"]
|
||||
],[
|
||||
"start",
|
||||
["text"," Coffee should not be served until the button has been pressed"]
|
||||
],[
|
||||
"start",
|
||||
["text"," If there is no coffee left then money should be refunded"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","Scenario Outline:"],
|
||||
["text"," Eating"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","Given"],
|
||||
["text"," there are "],
|
||||
["comment","<start>"],
|
||||
["text"," cucumbers"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","When"],
|
||||
["text"," I eat "],
|
||||
["comment","<eat>"],
|
||||
["text"," cucumbers"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","Then"],
|
||||
["text"," I should have "],
|
||||
["comment","<left>"],
|
||||
["text"," cucumbers"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","Examples:"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["comment","| "],
|
||||
["string","start "],
|
||||
["comment","| "],
|
||||
["string","eat "],
|
||||
["comment","| "],
|
||||
["string","left "],
|
||||
["comment","|"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["comment","| "],
|
||||
["string"," 12 "],
|
||||
["comment","| "],
|
||||
["string"," 5 "],
|
||||
["comment","| "],
|
||||
["string"," 7 "],
|
||||
["comment","|"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["comment","| "],
|
||||
["string"," 20 "],
|
||||
["comment","| "],
|
||||
["string"," 5 "],
|
||||
["comment","| "],
|
||||
["string"," 15 "],
|
||||
["comment","| "],
|
||||
["string"," "]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","Scenario:"],
|
||||
["text"," Buy last coffee"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","Given"],
|
||||
["text"," there are "],
|
||||
["constant.numeric","1"],
|
||||
["text"," coffees left in the machine"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","And"],
|
||||
["text"," I have deposited "],
|
||||
["constant.numeric","1"],
|
||||
["text","$ "]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","When"],
|
||||
["text"," I press the coffee button"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","Then"],
|
||||
["text"," I should be served a "],
|
||||
["string","\"coffee\""]
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["comment","# this a comment"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"qqstring3",
|
||||
["text"," "],
|
||||
["string","\"\"\""]
|
||||
],[
|
||||
"qqstring3",
|
||||
["string"," this is a "]
|
||||
],[
|
||||
"qqstring3",
|
||||
["string"," pystring"]
|
||||
],[
|
||||
"start",
|
||||
["string"," \"\"\""]
|
||||
]]
|
||||
|
|
@ -3,6 +3,11 @@
|
|||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
["meta.tag.tag-name.xml","html"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"]
|
||||
],[
|
||||
"start",
|
||||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
["meta.tag.tag-name.xml","scripts"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"]
|
||||
],[
|
||||
"start",
|
||||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
|
|
@ -13,10 +18,17 @@
|
|||
["string.attribute-value.xml","'a'"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"],
|
||||
["storage.type","var"],
|
||||
["text"," "],
|
||||
["string","\"</scripts>"],
|
||||
["meta.tag.punctuation.end-tag-open.xml","</"],
|
||||
["meta.tag.script.tag-name.xml","script"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"],
|
||||
["text.xml","'123'"]
|
||||
],[
|
||||
"start",
|
||||
["meta.tag.punctuation.end-tag-open.xml","</"],
|
||||
["meta.tag.tag-name.xml","scripts"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"]
|
||||
],[
|
||||
["string.attribute-value.xml0","tag_stuff"],
|
||||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
|
|
|
|||
23
lib/ace/mode/_test/tokens_ini.json
Normal file
23
lib/ace/mode/_test/tokens_ini.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[[
|
||||
"start",
|
||||
["punctuation.definition.entity.ini","["],
|
||||
["constant.section.group-title.ini",".ShellClassInfo"],
|
||||
["punctuation.definition.entity.ini","]"]
|
||||
],[
|
||||
"start",
|
||||
["keyword.other.definition.ini","IconResource"],
|
||||
["punctuation.separator.key-value.ini","="],
|
||||
["text","..\\logo.png"]
|
||||
],[
|
||||
"start",
|
||||
["punctuation.definition.entity.ini","["],
|
||||
["constant.section.group-title.ini","ViewState"],
|
||||
["punctuation.definition.entity.ini","]"]
|
||||
],[
|
||||
"start",
|
||||
["keyword.other.definition.ini","FolderType"],
|
||||
["punctuation.separator.key-value.ini","="],
|
||||
["text","Generic"]
|
||||
],[
|
||||
"start"
|
||||
]]
|
||||
|
|
@ -38,7 +38,13 @@
|
|||
],[
|
||||
"start"
|
||||
],[
|
||||
"start"
|
||||
"start",
|
||||
["text","v "],
|
||||
["keyword.operator.update.julia","="],
|
||||
["text"," "],
|
||||
["variable","α"],
|
||||
["keyword.operator.transposed-variable.julia","'"],
|
||||
["text",";"]
|
||||
],[
|
||||
"start",
|
||||
["keyword.other.julia","function"],
|
||||
|
|
|
|||
4
lib/ace/mode/_test/tokens_matlab.json
Normal file
4
lib/ace/mode/_test/tokens_matlab.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[[
|
||||
"start",
|
||||
["identifier","TODO"]
|
||||
]]
|
||||
4
lib/ace/mode/_test/tokens_mysql.json
Normal file
4
lib/ace/mode/_test/tokens_mysql.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[[
|
||||
"start",
|
||||
["identifier","TODO"]
|
||||
]]
|
||||
|
|
@ -297,10 +297,10 @@
|
|||
["comment.doc","* Dollar quotes starting at the end of the line are colored as SQL unless"]
|
||||
],[
|
||||
"doc-start",
|
||||
["comment.doc","* a special language tag is used. Pearl and Python are currently implemented"]
|
||||
["comment.doc","* a special language tag is used. Dollar quote syntax coloring is implemented"]
|
||||
],[
|
||||
"doc-start",
|
||||
["comment.doc","* but lots of others are possible."]
|
||||
["comment.doc","* for Perl, Python, JavaScript, and Json."]
|
||||
],[
|
||||
"start",
|
||||
["comment.doc","*/"]
|
||||
|
|
@ -662,6 +662,160 @@
|
|||
["statementEnd",";"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["comment","-- pl/v8 (javascript)"]
|
||||
],[
|
||||
"javascript-start",
|
||||
["keyword.statementBegin","CREATE"],
|
||||
["text"," "],
|
||||
["keyword","FUNCTION"],
|
||||
["text"," "],
|
||||
["identifier","plv8_test"],
|
||||
["paren.lparen","("],
|
||||
["identifier","keys"],
|
||||
["text"," "],
|
||||
["keyword","text"],
|
||||
["text","[], "],
|
||||
["identifier","vals"],
|
||||
["text"," "],
|
||||
["keyword","text"],
|
||||
["text","[]"],
|
||||
["paren.rparen",")"],
|
||||
["text"," "],
|
||||
["keyword","RETURNS"],
|
||||
["text"," "],
|
||||
["keyword","text"],
|
||||
["text"," "],
|
||||
["keyword","AS"],
|
||||
["text"," "],
|
||||
["string","$javascript$"]
|
||||
],[
|
||||
"javascript-start",
|
||||
["storage.type","var"],
|
||||
["text"," "],
|
||||
["identifier","o"],
|
||||
["text"," "],
|
||||
["keyword.operator","="],
|
||||
["text"," "],
|
||||
["paren.lparen","{"],
|
||||
["paren.rparen","}"],
|
||||
["punctuation.operator",";"]
|
||||
],[
|
||||
"javascript-start",
|
||||
["keyword","for"],
|
||||
["paren.lparen","("],
|
||||
["storage.type","var"],
|
||||
["text"," "],
|
||||
["identifier","i"],
|
||||
["keyword.operator","="],
|
||||
["constant.numeric","0"],
|
||||
["punctuation.operator",";"],
|
||||
["text"," "],
|
||||
["identifier","i"],
|
||||
["keyword.operator","<"],
|
||||
["identifier","keys"],
|
||||
["punctuation.operator","."],
|
||||
["support.constant","length"],
|
||||
["punctuation.operator",";"],
|
||||
["text"," "],
|
||||
["identifier","i"],
|
||||
["keyword.operator","++"],
|
||||
["paren.rparen",")"],
|
||||
["paren.lparen","{"]
|
||||
],[
|
||||
"javascript-start",
|
||||
["text"," "],
|
||||
["identifier","o"],
|
||||
["paren.lparen","["],
|
||||
["identifier","keys"],
|
||||
["paren.lparen","["],
|
||||
["identifier","i"],
|
||||
["paren.rparen","]]"],
|
||||
["text"," "],
|
||||
["keyword.operator","="],
|
||||
["text"," "],
|
||||
["identifier","vals"],
|
||||
["paren.lparen","["],
|
||||
["identifier","i"],
|
||||
["paren.rparen","]"],
|
||||
["punctuation.operator",";"]
|
||||
],[
|
||||
"javascript-no_regex",
|
||||
["paren.rparen","}"]
|
||||
],[
|
||||
"javascript-start",
|
||||
["keyword","return"],
|
||||
["text"," "],
|
||||
["variable.language","JSON"],
|
||||
["punctuation.operator","."],
|
||||
["identifier","stringify"],
|
||||
["paren.lparen","("],
|
||||
["identifier","o"],
|
||||
["paren.rparen",")"],
|
||||
["punctuation.operator",";"]
|
||||
],[
|
||||
"start",
|
||||
["string","$javascript$"],
|
||||
["text"," "],
|
||||
["keyword","LANGUAGE"],
|
||||
["text"," "],
|
||||
["identifier","plv8"],
|
||||
["text"," "],
|
||||
["keyword","IMMUTABLE"],
|
||||
["text"," "],
|
||||
["keyword","STRICT"],
|
||||
["statementEnd",";"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["comment","-- json"]
|
||||
],[
|
||||
"json-start",
|
||||
["keyword.statementBegin","select"],
|
||||
["text"," "],
|
||||
["keyword.operator","*"],
|
||||
["text"," "],
|
||||
["keyword","from"],
|
||||
["text"," "],
|
||||
["support.function","json_object_keys"],
|
||||
["paren.lparen","("],
|
||||
["string","$json$"]
|
||||
],[
|
||||
"json-start",
|
||||
["paren.lparen","{"]
|
||||
],[
|
||||
"json-start",
|
||||
["text"," "],
|
||||
["variable","\"f1\""],
|
||||
["text",": "],
|
||||
["constant.numeric","5"],
|
||||
["text",","]
|
||||
],[
|
||||
"json-start",
|
||||
["text"," "],
|
||||
["variable","\"f2\""],
|
||||
["text",": "],
|
||||
["string","\"test\""],
|
||||
["text",","]
|
||||
],[
|
||||
"json-start",
|
||||
["text"," "],
|
||||
["variable","\"f3\""],
|
||||
["text",": "],
|
||||
["paren.lparen","{"],
|
||||
["paren.rparen","}"]
|
||||
],[
|
||||
"json-start",
|
||||
["paren.rparen","}"]
|
||||
],[
|
||||
"start",
|
||||
["string","$json$"],
|
||||
["paren.rparen",")"],
|
||||
["statementEnd",";"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
|
|
|
|||
98
lib/ace/mode/_test/tokens_smarty.json
Normal file
98
lib/ace/mode/_test/tokens_smarty.json
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
[[
|
||||
"start",
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["keyword.control.smarty","foreach"],
|
||||
["source.smarty"," "],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","foo"],
|
||||
["source.smarty"," as "],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","bar"],
|
||||
["punctuation.section.embedded.end.smarty","}"]
|
||||
],[
|
||||
"start",
|
||||
["text.xml"," "],
|
||||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
["meta.tag.anchor.tag-name.xml","a"],
|
||||
["text.tag-whitespace.xml"," "],
|
||||
["entity.other.attribute-name.xml","href"],
|
||||
["keyword.operator.attribute-equals.xml","="],
|
||||
["string.attribute-value.xml","\""],
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","bar"],
|
||||
["source.smarty",".zig"],
|
||||
["punctuation.section.embedded.end.smarty","}"],
|
||||
["string.attribute-value.xml","\""],
|
||||
["meta.tag.punctuation.tag-close.xml",">"],
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","bar"],
|
||||
["source.smarty",".zag"],
|
||||
["punctuation.section.embedded.end.smarty","}"],
|
||||
["meta.tag.punctuation.end-tag-open.xml","</"],
|
||||
["meta.tag.anchor.tag-name.xml","a"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"]
|
||||
],[
|
||||
"start",
|
||||
["text.xml"," "],
|
||||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
["meta.tag.anchor.tag-name.xml","a"],
|
||||
["text.tag-whitespace.xml"," "],
|
||||
["entity.other.attribute-name.xml","href"],
|
||||
["keyword.operator.attribute-equals.xml","="],
|
||||
["string.attribute-value.xml","\""],
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","bar"],
|
||||
["source.smarty",".zig2"],
|
||||
["punctuation.section.embedded.end.smarty","}"],
|
||||
["string.attribute-value.xml","\""],
|
||||
["meta.tag.punctuation.tag-close.xml",">"],
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","bar"],
|
||||
["source.smarty",".zag2"],
|
||||
["punctuation.section.embedded.end.smarty","}"],
|
||||
["meta.tag.punctuation.end-tag-open.xml","</"],
|
||||
["meta.tag.anchor.tag-name.xml","a"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"]
|
||||
],[
|
||||
"start",
|
||||
["text.xml"," "],
|
||||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
["meta.tag.anchor.tag-name.xml","a"],
|
||||
["text.tag-whitespace.xml"," "],
|
||||
["entity.other.attribute-name.xml","href"],
|
||||
["keyword.operator.attribute-equals.xml","="],
|
||||
["string.attribute-value.xml","\""],
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","bar"],
|
||||
["source.smarty",".zig3"],
|
||||
["punctuation.section.embedded.end.smarty","}"],
|
||||
["string.attribute-value.xml","\""],
|
||||
["meta.tag.punctuation.tag-close.xml",">"],
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["punctuation.definition.variable.smarty","$"],
|
||||
["variable.other.smarty","bar"],
|
||||
["source.smarty",".zag3"],
|
||||
["punctuation.section.embedded.end.smarty","}"],
|
||||
["meta.tag.punctuation.end-tag-open.xml","</"],
|
||||
["meta.tag.anchor.tag-name.xml","a"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"]
|
||||
],[
|
||||
"start",
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["keyword.control.smarty","foreachelse"],
|
||||
["punctuation.section.embedded.end.smarty","}"]
|
||||
],[
|
||||
"start",
|
||||
["text.xml"," There were no rows found."]
|
||||
],[
|
||||
"start",
|
||||
["punctuation.section.embedded.begin.smarty","{"],
|
||||
["source.smarty","/"],
|
||||
["keyword.control.smarty","foreach"],
|
||||
["punctuation.section.embedded.end.smarty","}"]
|
||||
]]
|
||||
|
|
@ -5,18 +5,12 @@
|
|||
["text"," "],
|
||||
["punctuation.definition.string.begin.asp","\""],
|
||||
["string.quoted.double.asp","C:\\Wikipedia - VBScript - Example - Hello World.txt\""]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text","MakeHelloWorldFile myfilename"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"state_4",
|
||||
["meta.leading-space"," "]
|
||||
],[
|
||||
"state_4"
|
||||
],[
|
||||
"start",
|
||||
["storage.type.function.asp","Sub"],
|
||||
|
|
@ -26,14 +20,10 @@
|
|||
["punctuation.definition.parameters.asp","("],
|
||||
["variable.parameter.function.asp","FileName"],
|
||||
["punctuation.definition.parameters.asp",")"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["punctuation.definition.comment.asp","'"],
|
||||
["comment.line.apostrophe.asp","Create a new file in C: drive or overwrite existing file"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -47,8 +37,6 @@
|
|||
["punctuation.definition.string.begin.asp","\""],
|
||||
["string.quoted.double.asp","Scripting.FileSystemObject\""],
|
||||
["text",")"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -59,8 +47,6 @@
|
|||
["text","(FileName) "],
|
||||
["keyword.control.asp","Then"],
|
||||
["text"," "]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -81,8 +67,6 @@
|
|||
["punctuation.definition.string.begin.asp","\""],
|
||||
["string.quoted.double.asp"," exists ... OK to overwrite?\""],
|
||||
["text",", vbOKCancel)"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -90,8 +74,6 @@
|
|||
["meta.odd-tab.spaces"," "],
|
||||
["punctuation.definition.comment.asp","'"],
|
||||
["comment.line.apostrophe.asp","If button selected is not OK, then quit now"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -99,8 +81,6 @@
|
|||
["meta.odd-tab.spaces"," "],
|
||||
["punctuation.definition.comment.asp","'"],
|
||||
["comment.line.apostrophe.asp","vbOK is a language constant"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -113,15 +93,11 @@
|
|||
["keyword.control.asp","Then"],
|
||||
["text"," "],
|
||||
["keyword.control.asp","Exit Sub"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
["meta.leading-space"," "],
|
||||
["keyword.control.asp","Else"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -129,8 +105,6 @@
|
|||
["meta.odd-tab.spaces"," "],
|
||||
["punctuation.definition.comment.asp","'"],
|
||||
["comment.line.apostrophe.asp","Confirm OK to create"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -151,8 +125,6 @@
|
|||
["punctuation.definition.string.begin.asp","\""],
|
||||
["string.quoted.double.asp"," ... OK to create?\""],
|
||||
["text",", vbOKCancel)"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -165,23 +137,17 @@
|
|||
["keyword.control.asp","Then"],
|
||||
["text"," "],
|
||||
["keyword.control.asp","Exit Sub"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
["meta.leading-space"," "],
|
||||
["keyword.control.asp","End If"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
["meta.leading-space"," "],
|
||||
["punctuation.definition.comment.asp","'"],
|
||||
["comment.line.apostrophe.asp","Create new file (or replace an existing file)"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -190,8 +156,6 @@
|
|||
["text"," FileObject "],
|
||||
["keyword.operator.asp","="],
|
||||
["text"," FSO.CreateTextFile (FileName)"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -204,8 +168,6 @@
|
|||
["text"," "],
|
||||
["support.function.vb.asp","Now"],
|
||||
["text","()"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -213,8 +175,6 @@
|
|||
["text","FileObject.WriteLine "],
|
||||
["punctuation.definition.string.begin.asp","\""],
|
||||
["string.quoted.double.asp","Hello World\""]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -222,8 +182,6 @@
|
|||
["text","FileObject."],
|
||||
["entity.name.function.asp","Close"],
|
||||
["text","()"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["meta.odd-tab.spaces"," "],
|
||||
|
|
@ -239,8 +197,6 @@
|
|||
["text"," "],
|
||||
["punctuation.definition.string.begin.asp","\""],
|
||||
["string.quoted.double.asp"," ... updated.\""]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["support.function.asp","End"],
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var Rules = require("./abap_highlight_rules").AbapHighlightRules;
|
||||
var FoldMode = require("./folding/coffee").FoldMode;
|
||||
var Range = require("../range").Range;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules;
|
||||
// TODO: pick appropriate fold mode
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ApacheConfHighlightRules = require("./apache_conf_highlight_rules").ApacheConfHighlightRules;
|
||||
// TODO: pick appropriate fold mode
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
|
|
|||
55
lib/ace/mode/applescript.js
Normal file
55
lib/ace/mode/applescript.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var AppleScriptHighlightRules = require("./applescript_highlight_rules").AppleScriptHighlightRules;
|
||||
// TODO: pick appropriate fold mode
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = AppleScriptHighlightRules;
|
||||
this.foldingRules = new FoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.lineCommentStart = "--";
|
||||
this.blockComment = {start: "(*", end: "*)"};
|
||||
this.$id = "ace/mode/applescript";
|
||||
// Extra logic goes here.
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
139
lib/ace/mode/applescript_highlight_rules.js
Normal file
139
lib/ace/mode/applescript_highlight_rules.js
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var AppleScriptHighlightRules = function() {
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
var keywords = (
|
||||
"about|above|after|against|and|around|as|at|back|before|beginning|" +
|
||||
"behind|below|beneath|beside|between|but|by|considering|" +
|
||||
"contain|contains|continue|copy|div|does|eighth|else|end|equal|" +
|
||||
"equals|error|every|exit|fifth|first|for|fourth|from|front|" +
|
||||
"get|given|global|if|ignoring|in|into|is|it|its|last|local|me|" +
|
||||
"middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|" +
|
||||
"reference|repeat|returning|script|second|set|seventh|since|" +
|
||||
"sixth|some|tell|tenth|that|the|then|third|through|thru|" +
|
||||
"timeout|times|to|transaction|try|until|where|while|whose|with|without"
|
||||
);
|
||||
|
||||
var builtinConstants = (
|
||||
"AppleScript|false|linefeed|return|pi|quote|result|space|tab|true"
|
||||
);
|
||||
|
||||
var builtinFunctions = (
|
||||
"activate|beep|count|delay|launch|log|offset|read|round|run|say|" +
|
||||
"summarize|write"
|
||||
);
|
||||
|
||||
var builtinTypes = (
|
||||
"alias|application|boolean|class|constant|date|file|integer|list|" +
|
||||
"number|real|record|string|text|character|characters|contents|day|" +
|
||||
"frontmost|id|item|length|month|name|paragraph|paragraphs|rest|" +
|
||||
"reverse|running|time|version|weekday|word|words|year"
|
||||
);
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"support.function": builtinFunctions,
|
||||
"constant.language": builtinConstants,
|
||||
"support.type": builtinTypes,
|
||||
"keyword": keywords
|
||||
}, "identifier");
|
||||
|
||||
this.$rules = {
|
||||
"start": [
|
||||
{
|
||||
token: "comment",
|
||||
regex: "--.*$"
|
||||
},
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\(\\*",
|
||||
next : "comment"
|
||||
},
|
||||
{
|
||||
token: "string", // " string
|
||||
regex: '".*?"'
|
||||
},
|
||||
{
|
||||
token: "support.type",
|
||||
regex: '\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b'
|
||||
},
|
||||
{
|
||||
token: "support.function",
|
||||
regex: '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
|
||||
'mount volume|path to|(close|open for) access|(get|set) eof|' +
|
||||
'current date|do shell script|get volume settings|random number|' +
|
||||
'set volume|system attribute|system info|time to GMT|' +
|
||||
'(load|run|store) script|scripting components|' +
|
||||
'ASCII (character|number)|localized string|' +
|
||||
'choose (application|color|file|file name|' +
|
||||
'folder|from list|remote application|URL)|' +
|
||||
'display (alert|dialog))\\b|^\\s*return\\b'
|
||||
},
|
||||
{
|
||||
token: "constant.language",
|
||||
regex: '\\b(text item delimiters|current application|missing value)\\b'
|
||||
},
|
||||
{
|
||||
token: "keyword",
|
||||
regex: '\\b(apart from|aside from|instead of|out of|greater than|' +
|
||||
"isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
|
||||
'(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
|
||||
'contained by|comes (before|after)|a (ref|reference))\\b'
|
||||
},
|
||||
{
|
||||
token: keywordMapper,
|
||||
regex: "[a-zA-Z][a-zA-Z0-9_]*\\b"
|
||||
}
|
||||
],
|
||||
"comment": [
|
||||
{
|
||||
token: "comment", // closing comment
|
||||
regex: "\\*\\)",
|
||||
next: "start"
|
||||
}, {
|
||||
defaultToken: "comment"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(AppleScriptHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.AppleScriptHighlightRules = AppleScriptHighlightRules;
|
||||
});
|
||||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules;
|
||||
var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules;
|
||||
var FoldMode = require("./folding/coffee").FoldMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules;
|
||||
// TODO: pick appropriate fold mode
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules;
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var C9StyleFoldMode = require("./folding/c9search").FoldMode;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var CirruHighlightRules = require("./cirru_highlight_rules").CirruHighlightRules;
|
||||
var CoffeeFoldMode = require("./folding/coffee").FoldMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
|
|
@ -33,10 +33,8 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
|
||||
var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = ClojureHighlightRules;
|
||||
|
|
@ -47,29 +45,72 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
|
||||
this.lineCommentStart = ";";
|
||||
this.minorIndentFunctions = ["defn", "defn-", "defmacro", "def", "deftest", "testing"];
|
||||
|
||||
this.$toIndent = function(str) {
|
||||
return str.split('').map(function(ch) {
|
||||
if (/\s/.exec(ch)) {
|
||||
return ch;
|
||||
} else {
|
||||
return ' ';
|
||||
}
|
||||
}).join('');
|
||||
};
|
||||
|
||||
this.$calculateIndent = function(line, tab) {
|
||||
var baseIndent = this.$getIndent(line);
|
||||
var delta = 0;
|
||||
var isParen, ch;
|
||||
// Walk back from end of line, find matching braces
|
||||
for (var i = line.length - 1; i >= 0; i--) {
|
||||
ch = line[i];
|
||||
if (ch === '(') {
|
||||
delta--;
|
||||
isParen = true;
|
||||
} else if (ch === '(' || ch === '[' || ch === '{') {
|
||||
delta--;
|
||||
isParen = false;
|
||||
} else if (ch === ')' || ch === ']' || ch === '}') {
|
||||
delta++;
|
||||
}
|
||||
if (delta < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (delta < 0 && isParen) {
|
||||
// Were more brackets opened than closed and was a ( left open?
|
||||
i += 1;
|
||||
var iBefore = i;
|
||||
var fn = '';
|
||||
while (true) {
|
||||
ch = line[i];
|
||||
if (ch === ' ' || ch === '\t') {
|
||||
if(this.minorIndentFunctions.indexOf(fn) !== -1) {
|
||||
return this.$toIndent(line.substring(0, iBefore - 1) + tab);
|
||||
} else {
|
||||
return this.$toIndent(line.substring(0, i + 1));
|
||||
}
|
||||
} else if (ch === undefined) {
|
||||
return this.$toIndent(line.substring(0, iBefore - 1) + tab);
|
||||
}
|
||||
fn += line[i];
|
||||
i++;
|
||||
}
|
||||
} else if(delta < 0 && !isParen) {
|
||||
// Were more brackets openend than closed and was it not a (?
|
||||
return this.$toIndent(line.substring(0, i+1));
|
||||
} else if(delta > 0) {
|
||||
// Mere more brackets closed than opened? Outdent.
|
||||
baseIndent = baseIndent.substring(0, baseIndent.length - tab.length);
|
||||
return baseIndent;
|
||||
} else {
|
||||
// Were they nicely matched? Just indent like line before.
|
||||
return baseIndent;
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start") {
|
||||
var match = line.match(/[\(\[]/);
|
||||
if (match) {
|
||||
indent += " ";
|
||||
}
|
||||
match = line.match(/[\)]/);
|
||||
if (match) {
|
||||
indent = "";
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
return this.$calculateIndent(line, tab);
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
|
||||
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var FoldMode = require("./folding/coffee").FoldMode;
|
||||
|
|
@ -50,7 +49,28 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
|
||||
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/;
|
||||
/*:
|
||||
[({[=:] # Opening parentheses or brackets
|
||||
|[-=]> # OR single or double arrow
|
||||
|\b(?: # OR one of these words:
|
||||
else # else
|
||||
|try # OR try
|
||||
|(?:swi|ca)tch # OR catch, optionally followed by:
|
||||
(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)? # a variable
|
||||
|finally # OR finally
|
||||
))\s*$ # all as the last thing on a line (allowing trailing space)
|
||||
| # ---- OR ---- :
|
||||
^\s* # a line starting with optional space
|
||||
(else\b\s*)? # followed by an optional "else"
|
||||
(?: # followed by one of the following:
|
||||
if # if
|
||||
|for # OR for
|
||||
|while # OR while
|
||||
|loop # OR loop
|
||||
)\b # (as a word)
|
||||
(?!.*\bthen\b) # ... but NOT followed by "then" on the line
|
||||
*/
|
||||
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/;
|
||||
var commentLine = /^(\s*)#/;
|
||||
var hereComment = /^\s*###(?!#)/;
|
||||
var indentation = /^\s*/;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ define(function(require, exports, module) {
|
|||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
|
||||
|
||||
var voidElements = "cfabort|cfapplication|cfargument|cfassociate|cfbreak|cfcache|cfcollection|cfcookie|cfdbinfo|cfdirectory|cfdump|cfelse|cfelseif|cferror|cfexchangecalendar|cfexchangeconnection|cfexchangecontact|cfexchangefilter|cfexchangetask|cfexit|cffeed|cffile|cfflush|cfftp|cfheader|cfhtmlhead|cfhttpparam|cfimage|cfimport|cfinclude|cfindex|cfinsert|cfinvokeargument|cflocation|cflog|cfmailparam|cfNTauthenticate|cfobject|cfobjectcache|cfparam|cfpdfformparam|cfprint|cfprocparam|cfprocresult|cfproperty|cfqueryparam|cfregistry|cfreportparam|cfrethrow|cfreturn|cfschedule|cfsearch|cfset|cfsetting|cfthrow|cfzipparam)".split("|");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@ var CSharpHighlightRules = function() {
|
|||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "string.regexp",
|
||||
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||
}, {
|
||||
token : "string", // character
|
||||
regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -76,6 +76,8 @@ oop.inherits(Worker, Mirror);
|
|||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
if (!value)
|
||||
return this.sender.emit("csslint", []);
|
||||
var infoRules = this.infoRules;
|
||||
|
||||
var result = CSSLint.verify(value, this.ruleset);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ define(function(require, exports, module) {
|
|||
var oop = require("../lib/oop");
|
||||
// defines the parent mode
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||
var HtmlFoldMode = require("./folding/html").FoldMode;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var DHighlightRules = require("./d_highlight_rules").DHighlightRules;
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ var DHighlightRules = function() {
|
|||
|
||||
var stringEscapesSeq = {
|
||||
token: "constant.language.escape",
|
||||
regex: "\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\"\\?0abfnrtv])|" +
|
||||
regex: "\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\"\\?0abfnrtv\\\\])|" +
|
||||
"(?:u[0-9a-fA-F]{4})|(?:U[0-9a-fA-F]{8}))"
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("../lib/oop");
|
||||
var CMode = require("./c_cpp").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue