kopia lustrzana https://github.com/c9/core
Merge remote-tracking branch 'origin/master' into revert-13177-revert-13004-all-fix-vfs-activate
commit
ad5659498f
|
@ -109,6 +109,7 @@ module.exports = function(options) {
|
|||
|
||||
// VFS
|
||||
"plugins/c9.vfs.client/vfs.ping",
|
||||
"plugins/c9.vfs.client/vfs.log",
|
||||
{
|
||||
packagePath: "plugins/c9.vfs.client/vfs_client",
|
||||
debug: debug,
|
||||
|
|
|
@ -62,10 +62,12 @@ exports.config = require("./config");
|
|||
* Provides access to require in packed noconflict mode
|
||||
* @param {String} moduleName
|
||||
* @returns {Object}
|
||||
*
|
||||
**/
|
||||
exports.require = require;
|
||||
|
||||
if (typeof define === "function")
|
||||
exports.define = define;
|
||||
|
||||
/**
|
||||
* Embeds the Ace editor into the DOM, at the element provided by `el`.
|
||||
* @param {String | DOMElement} el Either the id of an element, or the element itself
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
overflow: hidden;
|
||||
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.ace_scroller {
|
||||
|
|
|
@ -67,6 +67,7 @@ var supportedModes = {
|
|||
Diff: ["diff|patch"],
|
||||
Dockerfile: ["^Dockerfile"],
|
||||
Dot: ["dot"],
|
||||
Drools: ["drl"],
|
||||
Dummy: ["dummy"],
|
||||
DummySyntax: ["dummy"],
|
||||
Eiffel: ["e|ge"],
|
||||
|
@ -165,6 +166,7 @@ var supportedModes = {
|
|||
Toml: ["toml"],
|
||||
Twig: ["twig|swig"],
|
||||
Typescript: ["ts|typescript|str"],
|
||||
TSX: ["tsx"],
|
||||
Vala: ["vala"],
|
||||
VBScript: ["vbs|vb"],
|
||||
Velocity: ["vm"],
|
||||
|
|
|
@ -63,6 +63,7 @@ var themeData = [
|
|||
["Chaos" ,"chaos" , "dark"],
|
||||
["Clouds Midnight" ,"clouds_midnight" , "dark"],
|
||||
["Cobalt" ,"cobalt" , "dark"],
|
||||
["Gruvbox" ,"gruvbox" , "dark"],
|
||||
["idle Fingers" ,"idle_fingers" , "dark"],
|
||||
["krTheme" ,"kr_theme" , "dark"],
|
||||
["Merbivore" ,"merbivore" , "dark"],
|
||||
|
|
|
@ -263,18 +263,22 @@ var TextInput = function(parentNode, host) {
|
|||
resetValue();
|
||||
};
|
||||
|
||||
var handleClipboardData = function(e, data) {
|
||||
var handleClipboardData = function(e, data, forceIEMime) {
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
if (!clipboardData || BROKEN_SETDATA)
|
||||
return;
|
||||
// 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()
|
||||
return clipboardData.setData(mime, data) !== false;
|
||||
} else {
|
||||
return clipboardData.getData(mime);
|
||||
var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain";
|
||||
try {
|
||||
if (data) {
|
||||
// Safari 5 has clipboardData object, but does not handle setData()
|
||||
return clipboardData.setData(mime, data) !== false;
|
||||
} else {
|
||||
return clipboardData.getData(mime);
|
||||
}
|
||||
} catch(e) {
|
||||
if (!forceIEMime)
|
||||
return handleClipboardData(e, data, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -863,9 +863,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
|||
{ keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
|
||||
{ keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
|
||||
{ keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },
|
||||
{ keys: 's', type: 'keyToKey', toKeys: 'xi', context: 'visual'},
|
||||
{ keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},
|
||||
{ keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },
|
||||
{ keys: 'S', type: 'keyToKey', toKeys: 'dcc', context: 'visual' },
|
||||
{ keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },
|
||||
{ keys: '<Home>', type: 'keyToKey', toKeys: '0' },
|
||||
{ keys: '<End>', type: 'keyToKey', toKeys: '$' },
|
||||
{ keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },
|
||||
|
@ -963,6 +963,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
|||
{ keys: 'v', type: 'action', action: 'toggleVisualMode' },
|
||||
{ keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }},
|
||||
{ keys: '<C-v>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
|
||||
{ keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
|
||||
{ keys: 'gv', type: 'action', action: 'reselectLastSelection' },
|
||||
{ keys: 'J', type: 'action', action: 'joinLines', isEdit: true },
|
||||
{ keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }},
|
||||
|
@ -1481,8 +1482,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
|||
exCommandDispatcher.map(lhs, rhs, ctx);
|
||||
},
|
||||
unmap: function(lhs, ctx) {
|
||||
// remove user defined key bindings.
|
||||
exCommandDispatcher.unmap(lhs, ctx || "normal");
|
||||
exCommandDispatcher.unmap(lhs, ctx);
|
||||
},
|
||||
// TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace
|
||||
// them, or somehow make them work with the existing CodeMirror setOption/getOption API.
|
||||
|
|
|
@ -1135,6 +1135,20 @@ testVim('D_visual_block', function(cm, vim, helpers) {
|
|||
eq('1\n5\na', cm.getValue());
|
||||
}, {value: '1234\n5678\nabcdefg'});
|
||||
|
||||
testVim('s_visual_block', function(cm, vim, helpers) {
|
||||
cm.setCursor(0, 1);
|
||||
helpers.doKeys('<C-v>', '2', 'j', 'l', 'l', 'l', 's');
|
||||
var replacement = fillArray('hello{', 3);
|
||||
cm.replaceSelections(replacement);
|
||||
eq('1hello{\n5hello{\nahello{fg\n', cm.getValue());
|
||||
helpers.doKeys('<Esc>');
|
||||
cm.setCursor(2, 3);
|
||||
helpers.doKeys('<C-v>', '1', 'k', 'h', 'S');
|
||||
replacement = fillArray('world', 1);
|
||||
cm.replaceSelections(replacement);
|
||||
eq('1hello{\n world\n', cm.getValue());
|
||||
}, {value: '1234\n5678\nabcdefg\n'});
|
||||
|
||||
// Swapcase commands edit in place and do not modify registers.
|
||||
testVim('g~w_repeat', function(cm, vim, helpers) {
|
||||
// Assert that dw does delete newline if it should go to the next line, and
|
||||
|
@ -3210,6 +3224,25 @@ forEach(['zb','zz','zt','z-','z.','z<CR>'], function(e, idx){
|
|||
return new Array(500).join('\n');
|
||||
})()});
|
||||
});
|
||||
testVim('zb_to_bottom', function(cm, vim, helpers){
|
||||
var lineNum = 250;
|
||||
cm.setSize(600, 35*cm.defaultTextHeight());
|
||||
cm.setCursor(lineNum, 0);
|
||||
helpers.doKeys('z', 'b');
|
||||
var scrollInfo = cm.getScrollInfo();
|
||||
eq(scrollInfo.top + scrollInfo.clientHeight, cm.charCoords(Pos(lineNum, 0), 'local').bottom);
|
||||
}, { value: (function(){
|
||||
return new Array(500).join('\n');
|
||||
})()});
|
||||
testVim('zt_to_top', function(cm, vim, helpers){
|
||||
var lineNum = 250;
|
||||
cm.setSize(600, 35*cm.defaultTextHeight());
|
||||
cm.setCursor(lineNum, 0);
|
||||
helpers.doKeys('z', 't');
|
||||
eq(cm.getScrollInfo().top, cm.charCoords(Pos(lineNum, 0), 'local').top);
|
||||
}, { value: (function(){
|
||||
return new Array(500).join('\n');
|
||||
})()});
|
||||
testVim('zb<zz', function(cm, vim, helpers){
|
||||
eq(zVals[0]<zVals[1], true);
|
||||
});
|
||||
|
@ -4024,7 +4057,13 @@ testVim('ex_imap', function(cm, vim, helpers) {
|
|||
is(vim.insertMode);
|
||||
helpers.doKeys('j', 'k');
|
||||
is(!vim.insertMode);
|
||||
})
|
||||
});
|
||||
testVim('ex_unmap_api', function(cm, vim, helpers) {
|
||||
CodeMirror.Vim.map('<Alt-X>', 'gg', 'normal');
|
||||
is(CodeMirror.Vim.handleKey(cm, "<Alt-X>", "normal"), "Alt-X key is mapped");
|
||||
CodeMirror.Vim.unmap("<Alt-X>", "normal");
|
||||
is(!CodeMirror.Vim.handleKey(cm, "<Alt-X>", "normal"), "Alt-X key is unmapped");
|
||||
});
|
||||
|
||||
// Testing registration of functions as ex-commands and mapping to <Key>-keys
|
||||
testVim('ex_api_test', function(cm, vim, helpers) {
|
||||
|
|
|
@ -260,7 +260,7 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
|||
var hashId = getModifierHash(e);
|
||||
|
||||
if (!useragent.isMac && pressedKeys) {
|
||||
if (pressedKeys.OSKey)
|
||||
if (e.getModifierState && (e.getModifierState("OS") || e.getModifierState("Win")))
|
||||
hashId |= 8;
|
||||
if (pressedKeys.altGr) {
|
||||
if ((3 & hashId) != 3)
|
||||
|
@ -339,19 +339,8 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
var lastDefaultPrevented = null;
|
||||
|
||||
addListener(el, "keydown", function(e) {
|
||||
var keyCode = e.keyCode;
|
||||
pressedKeys[keyCode] = (pressedKeys[keyCode] || 0) + 1;
|
||||
if (keyCode == 91 || keyCode == 92) {
|
||||
pressedKeys.OSKey = true;
|
||||
} else if (pressedKeys.OSKey) {
|
||||
if (e.timeStamp - pressedKeys.lastT > 200 && pressedKeys.count == 1)
|
||||
resetPressedKeys();
|
||||
}
|
||||
if (pressedKeys[keyCode] == 1)
|
||||
pressedKeys.count++;
|
||||
// console.log(e.timeStamp - pressedKeys.lastT)
|
||||
pressedKeys.lastT = e.timeStamp;
|
||||
var result = normalizeCommandKeys(callback, e, keyCode);
|
||||
pressedKeys[e.keyCode] = (pressedKeys[e.keyCode] || 0) + 1;
|
||||
var result = normalizeCommandKeys(callback, e, e.keyCode);
|
||||
lastDefaultPrevented = e.defaultPrevented;
|
||||
return result;
|
||||
});
|
||||
|
@ -364,17 +353,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
});
|
||||
|
||||
addListener(el, "keyup", function(e) {
|
||||
var keyCode = e.keyCode;
|
||||
if (!pressedKeys[keyCode]) {
|
||||
// console.log("resetting", 1)
|
||||
resetPressedKeys();
|
||||
} else {
|
||||
pressedKeys.count = Math.max(pressedKeys.count - 1, 0);
|
||||
}
|
||||
if (keyCode == 91 || keyCode == 92) {
|
||||
pressedKeys.OSKey = false;
|
||||
}
|
||||
pressedKeys[keyCode] = null;
|
||||
pressedKeys[e.keyCode] = null;
|
||||
});
|
||||
|
||||
if (!pressedKeys) {
|
||||
|
@ -386,8 +365,6 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
function resetPressedKeys() {
|
||||
// console.log("resetting")
|
||||
pressedKeys = Object.create(null);
|
||||
pressedKeys.count = 0;
|
||||
pressedKeys.lastT = 0;
|
||||
}
|
||||
|
||||
if (typeof window == "object" && window.postMessage && !useragent.isOldIE) {
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
["keyword.operator","!"],
|
||||
["paren.lparen","("],
|
||||
["string.quoted.double.source.rust","\"%s says: '%d'"],
|
||||
["constant.character.escape.source.rust","\\n"],
|
||||
["constant.character.escape.source.rust","\\n\\\\"],
|
||||
["string.quoted.double.source.rust","\""],
|
||||
["punctuation.operator",","],
|
||||
["text"," name"],
|
||||
|
|
|
@ -161,7 +161,7 @@ module.exports = {
|
|||
" <SelfClosingTag />"
|
||||
].join("\n"));
|
||||
editor.session.setMode(new XMLMode);
|
||||
exec("gotolinedown", 1);
|
||||
exec("golinedown", 1);
|
||||
exec("gotolineend", 1);
|
||||
exec("insertstring", 1, '\n');
|
||||
assert.equal(editor.session.getLine(2), " ");
|
||||
|
@ -169,6 +169,14 @@ module.exports = {
|
|||
exec("gotolineend", 1);
|
||||
exec("insertstring", 1, '\n');
|
||||
assert.equal(editor.session.getLine(2), " ");
|
||||
editor.session.setValue(["<OuterTag",
|
||||
" <xyzrt"
|
||||
].join("\n"));
|
||||
exec("golinedown", 1);
|
||||
exec("gotolineend", 1);
|
||||
exec("selectleft", 3);
|
||||
exec("insertstring", 1, '>');
|
||||
assert.equal(editor.session.getLine(1), " <xy></xy>");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -251,6 +251,8 @@ var CstyleBehaviour = function() {
|
|||
|
||||
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
||||
if (text == '"' || text == "'") {
|
||||
if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1)
|
||||
return;
|
||||
initContext(editor);
|
||||
var quote = text;
|
||||
var selection = editor.getSelectionRange();
|
||||
|
|
|
@ -100,7 +100,7 @@ var XmlBehaviour = function () {
|
|||
|
||||
this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '>') {
|
||||
var position = editor.getCursorPosition();
|
||||
var position = editor.getSelectionRange().start;
|
||||
var iterator = new TokenIterator(session, position.row, position.column);
|
||||
var token = iterator.getCurrentToken() || iterator.stepBackward();
|
||||
|
||||
|
@ -124,6 +124,10 @@ var XmlBehaviour = function () {
|
|||
// find tag name
|
||||
while (!is(token, "tag-name")) {
|
||||
token = iterator.stepBackward();
|
||||
if (token.value == "<") {
|
||||
token = iterator.stepForward();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var tokenRow = iterator.getCurrentTokenRow();
|
||||
|
|
|
@ -75,7 +75,7 @@ var ColdfusionHighlightRules = function() {
|
|||
this.$rules[s].unshift(cfTag);
|
||||
}, this);
|
||||
|
||||
this.embedTagRules(new JavaScriptHighlightRules({noJSX: true}).getRules(), "cfjs-", "cfscript");
|
||||
this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "cfjs-", "cfscript");
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2014, 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 DroolsHighlightRules = require("./drools_highlight_rules").DroolsHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
var DroolsFoldMode = require("./folding/drools").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = DroolsHighlightRules;
|
||||
this.foldingRules = new DroolsFoldMode();
|
||||
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.$id = "ace/mode/drools";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,262 @@
|
|||
/* ***** 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 JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
|
||||
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
|
||||
var packageIdentifierRe = "[a-zA-Z\\$_\u00a1-\uffff][\\.a-zA-Z\\d\\$_\u00a1-\uffff]*";
|
||||
|
||||
var DroolsHighlightRules = function() {
|
||||
|
||||
var keywords = ("date|effective|expires|lock|on|active|no|loop|auto|focus" +
|
||||
"|activation|group|agenda|ruleflow|duration|timer|calendars|refract|direct" +
|
||||
"|dialect|salience|enabled|attributes|extends|template" +
|
||||
"|function|contains|matches|eval|excludes|soundslike" +
|
||||
"|memberof|not|in|or|and|exists|forall|over|from|entry|point|accumulate|acc|collect" +
|
||||
"|action|reverse|result|end|init|instanceof|extends|super|boolean|char|byte|short" +
|
||||
"|int|long|float|double|this|void|class|new|case|final|if|else|for|while|do" +
|
||||
"|default|try|catch|finally|switch|synchronized|return|throw|break|continue|assert" +
|
||||
"|modify|static|public|protected|private|abstract|native|transient|volatile" +
|
||||
"|strictfp|throws|interface|enum|implements|type|window|trait|no-loop|str"
|
||||
);
|
||||
|
||||
var langClasses = (
|
||||
"AbstractMethodError|AssertionError|ClassCircularityError|"+
|
||||
"ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
|
||||
"ExceptionInInitializerError|IllegalAccessError|"+
|
||||
"IllegalThreadStateException|InstantiationError|InternalError|"+
|
||||
"NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
|
||||
"ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
|
||||
"SuppressWarnings|TypeNotPresentException|UnknownError|"+
|
||||
"UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
|
||||
"InstantiationException|IndexOutOfBoundsException|"+
|
||||
"ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
|
||||
"NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
|
||||
"SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
|
||||
"InterruptedException|NoSuchMethodException|IllegalAccessException|"+
|
||||
"UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
|
||||
"Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
|
||||
"NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
|
||||
"NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
|
||||
"Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
|
||||
"Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
|
||||
"StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
|
||||
"ArrayStoreException|ClassCastException|LinkageError|"+
|
||||
"NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
|
||||
"Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
|
||||
"Cloneable|Class|CharSequence|Comparable|String|Object"
|
||||
);
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"variable.language": "this",
|
||||
"keyword": keywords,
|
||||
"constant.language": "null",
|
||||
"support.class" : langClasses,
|
||||
"support.function" : "retract|update|modify|insert"
|
||||
}, "identifier");
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
var stringRules = function() {
|
||||
return [{
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
var basicPreRules = function(blockCommentRules) {
|
||||
return [{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
next : blockCommentRules
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : "(?:true|false)\\b"
|
||||
}];
|
||||
};
|
||||
|
||||
var blockCommentRules = function(returnRule) {
|
||||
return [
|
||||
{
|
||||
token : "comment.block", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : returnRule
|
||||
}, {
|
||||
token : "comment.block", // comment spanning whole line
|
||||
regex : ".+"
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
var basicPostRules = function() {
|
||||
return [{
|
||||
token : keywordMapper,
|
||||
// TODO: Unicode escape sequences
|
||||
// TODO: Unicode identifiers
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
||||
}, {
|
||||
token : "lparen",
|
||||
regex : "[[({]"
|
||||
}, {
|
||||
token : "rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
this.$rules = {
|
||||
"start" : [].concat(basicPreRules("block.comment"), [
|
||||
{
|
||||
token : "entity.name.type",
|
||||
regex : "@[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
// package com.example
|
||||
token : ["keyword","text","entity.name.type"],
|
||||
regex : "(package)(\\s+)(" + packageIdentifierRe +")"
|
||||
}, {
|
||||
// import function com.Util.staticMethod
|
||||
token : ["keyword","text","keyword","text","entity.name.type"],
|
||||
regex : "(import)(\\s+)(function)(\\s+)(" + packageIdentifierRe +")"
|
||||
}, {
|
||||
// import function com.Util.staticMethod
|
||||
token : ["keyword","text","entity.name.type"],
|
||||
regex : "(import)(\\s+)(" + packageIdentifierRe +")"
|
||||
}, {
|
||||
// global com.example.Type identifier
|
||||
token : ["keyword","text","entity.name.type","text","variable"],
|
||||
regex : "(global)(\\s+)(" + packageIdentifierRe +")(\\s+)(" + identifierRe +")"
|
||||
}, {
|
||||
// declare trait DeclaredType
|
||||
token : ["keyword","text","keyword","text","entity.name.type"],
|
||||
regex : "(declare)(\\s+)(trait)(\\s+)(" + identifierRe +")"
|
||||
}, {
|
||||
// declare trait DeclaredType
|
||||
token : ["keyword","text","entity.name.type"],
|
||||
regex : "(declare)(\\s+)(" + identifierRe +")"
|
||||
}, {
|
||||
// declare trait DeclaredType
|
||||
token : ["keyword","text","entity.name.type"],
|
||||
regex : "(extends)(\\s+)(" + packageIdentifierRe +")"
|
||||
}, {
|
||||
// rule ...
|
||||
token : ["keyword","text"],
|
||||
regex : "(rule)(\\s+)",
|
||||
next : "asset.name"
|
||||
}],
|
||||
stringRules(),
|
||||
[{
|
||||
// variable :
|
||||
token : ["variable.other","text","text"],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)"
|
||||
}, {
|
||||
// query ...
|
||||
token : ["keyword","text"],
|
||||
regex : "(query)(\\s+)",
|
||||
next : "asset.name"
|
||||
}, {
|
||||
// when ...
|
||||
token : ["keyword","text"],
|
||||
regex : "(when)(\\s*)"
|
||||
}, {
|
||||
// then <java/mvel code> end
|
||||
token : ["keyword","text"],
|
||||
regex : "(then)(\\s*)",
|
||||
next : "java-start"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]/
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]/
|
||||
}], basicPostRules()),
|
||||
"block.comment" : blockCommentRules("start"),
|
||||
"asset.name" : [
|
||||
{
|
||||
token : "entity.name",
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "entity.name",
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "entity.name",
|
||||
regex : identifierRe
|
||||
}, {
|
||||
regex: "",
|
||||
token: "empty",
|
||||
next: "start"
|
||||
}]
|
||||
};
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
|
||||
this.embedRules(JavaHighlightRules, "java-", [
|
||||
{
|
||||
token : "support.function",
|
||||
regex: "\\b(insert|modify|retract|update)\\b"
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex: "\\bend\\b",
|
||||
next : "start"
|
||||
}]);
|
||||
|
||||
};
|
||||
|
||||
oop.inherits(DroolsHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.DroolsHighlightRules = DroolsHighlightRules;
|
||||
});
|
|
@ -0,0 +1,49 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Range = require("../../range").Range;
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||
|
||||
var FoldMode = exports.FoldMode = function() {};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
// regular expressions that identify starting and stopping points
|
||||
this.foldingStartMarker = /\b(rule|declare|query|when|then)\b/;
|
||||
this.foldingStopMarker = /\bend\b/;
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
var match = line.match(this.foldingStartMarker);
|
||||
if (match) {
|
||||
var i = match.index;
|
||||
|
||||
if (match[1]) {
|
||||
var position = {row: row, column: line.length};
|
||||
var iterator = new TokenIterator(session, position.row, position.column);
|
||||
var seek = "end";
|
||||
var token = iterator.getCurrentToken();
|
||||
if (token.value == "when") {
|
||||
seek = "then";
|
||||
}
|
||||
while (token) {
|
||||
if (token.value == seek) {
|
||||
return Range.fromPoints(position ,{
|
||||
row: iterator.getCurrentTokenRow(),
|
||||
column: iterator.getCurrentTokenColumn()
|
||||
});
|
||||
}
|
||||
token = iterator.stepForward();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// test each line, and return a range of segments to collapse
|
||||
}
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
|
@ -0,0 +1,112 @@
|
|||
/* ***** 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 ***** */
|
||||
|
||||
/* Derived from Python rules */
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var FortranHighlightRules = require("./fortran_highlight_rules").FortranHighlightRules;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = FortranHighlightRules;
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.lineCommentStart = "!";
|
||||
|
||||
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(/^.*[\{\(\[\:]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
var outdents = {
|
||||
"return": 1,
|
||||
"break": 1,
|
||||
"continue": 1,
|
||||
"RETURN": 1,
|
||||
"BREAK": 1,
|
||||
"CONTINUE": 1
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
if (input !== "\r\n" && input !== "\r" && input !== "\n")
|
||||
return false;
|
||||
|
||||
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
||||
|
||||
if (!tokens)
|
||||
return false;
|
||||
do {
|
||||
var last = tokens.pop();
|
||||
} while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
|
||||
|
||||
if (!last)
|
||||
return false;
|
||||
|
||||
return (last.type == "keyword" && outdents[last.value]);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
|
||||
row += 1;
|
||||
var indent = this.$getIndent(doc.getLine(row));
|
||||
var tab = doc.getTabString();
|
||||
if (indent.slice(-tab.length) == tab)
|
||||
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/fortran";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
|
@ -0,0 +1,233 @@
|
|||
/* ***** 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 ***** */
|
||||
|
||||
/* Derived from Python highlighing rules */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var FortranHighlightRules = function() {
|
||||
|
||||
var keywords = (
|
||||
"call|case|contains|continue|cycle|do|else|elseif|end|enddo|endif|function|"+
|
||||
"if|implicit|in|include|inout|intent|module|none|only|out|print|program|return|"+
|
||||
"select|status|stop|subroutine|" +
|
||||
"return|then|use|while|write|"+
|
||||
"CALL|CASE|CONTAINS|CONTINUE|CYCLE|DO|ELSE|ELSEIF|END|ENDDO|ENDIF|FUNCTION|"+
|
||||
"IF|IMPLICIT|IN|INCLUDE|INOUT|INTENT|MODULE|NONE|ONLY|OUT|PRINT|PROGRAM|RETURN|"+
|
||||
"SELECT|STATUS|STOP|SUBROUTINE|" +
|
||||
"RETURN|THEN|USE|WHILE|WRITE"
|
||||
);
|
||||
|
||||
var keywordOperators = (
|
||||
"and|or|not|eq|ne|gt|ge|lt|le|" +
|
||||
"AND|OR|NOT|EQ|NE|GT|GE|LT|LE"
|
||||
);
|
||||
|
||||
var builtinConstants = (
|
||||
"true|false|TRUE|FALSE"
|
||||
);
|
||||
|
||||
var builtinFunctions = (
|
||||
"abs|achar|acos|acosh|adjustl|adjustr|aimag|aint|all|allocate|"+
|
||||
"anint|any|asin|asinh|associated|atan|atan2|atanh|"+
|
||||
"bessel_j0|bessel_j1|bessel_jn|bessel_y0|bessel_y1|bessel_yn|"+
|
||||
"bge|bgt|bit_size|ble|blt|btest|ceiling|char|cmplx|conjg|cos|cosh|"+
|
||||
"count|cpu_time|cshift|date_and_time|dble|deallocate|digits|dim|dot_product|dprod|"+
|
||||
"dshiftl|dshiftr|dsqrt|eoshift|epsilon|erf|erfc|erfc_scaled|exp|float|floor|"+
|
||||
"format|fraction|gamma|input|len|lge|lgt|lle|llt|log|log10|maskl|maskr|matmul|max|maxloc|maxval|"+
|
||||
"merge|min|minloc|minval|mod|modulo|nint|not|norm2|null|nullify|pack|parity|popcnt|poppar|"+
|
||||
"precision|present|product|radix|random_number|random_seed|range|repeat|reshape|round|"+
|
||||
"rrspacing|same_type_as|scale|scan|selected_char_kind|selected_int_kind|selected_real_kind|"+
|
||||
"set_exponent|shape|shifta|shiftl|shiftr|sign|sin|sinh|size|sngl|spacing|spread|"+
|
||||
"sqrt|sum|system_clock|tan|tanh|tiny|trailz|transfer|transpose|trim|ubound|unpack|verify|" +
|
||||
"ABS|ACHAR|ACOS|ACOSH|ADJUSTL|ADJUSTR|AIMAG|AINT|ALL|ALLOCATE|"+
|
||||
"ANINT|ANY|ASIN|ASINH|ASSOCIATED|ATAN|ATAN2|ATANH|"+
|
||||
"BESSEL_J0|BESSEL_J1|BESSEL_JN|BESSEL_Y0|BESSEL_Y1|BESSEL_YN|"+
|
||||
"BGE|BGT|BIT_SIZE|BLE|BLT|BTEST|CEILING|CHAR|CMPLX|CONJG|COS|COSH|"+
|
||||
"COUNT|CPU_TIME|CSHIFT|DATE_AND_TIME|DBLE|DEALLOCATE|DIGITS|DIM|DOT_PRODUCT|DPROD|"+
|
||||
"DSHIFTL|DSHIFTR|DSQRT|EOSHIFT|EPSILON|ERF|ERFC|ERFC_SCALED|EXP|FLOAT|FLOOR|"+
|
||||
"FORMAT|FRACTION|GAMMA|INPUT|LEN|LGE|LGT|LLE|LLT|LOG|LOG10|MASKL|MASKR|MATMUL|MAX|MAXLOC|MAXVAL|"+
|
||||
"MERGE|MIN|MINLOC|MINVAL|MOD|MODULO|NINT|NOT|NORM2|NULL|NULLIFY|PACK|PARITY|POPCNT|POPPAR|"+
|
||||
"PRECISION|PRESENT|PRODUCT|RADIX|RANDOM_NUMBER|RANDOM_SEED|RANGE|REPEAT|RESHAPE|ROUND|"+
|
||||
"RRSPACING|SAME_TYPE_AS|SCALE|SCAN|SELECTED_CHAR_KIND|SELECTED_INT_KIND|SELECTED_REAL_KIND|"+
|
||||
"SET_EXPONENT|SHAPE|SHIFTA|SHIFTL|SHIFTR|SIGN|SIN|SINH|SIZE|SNGL|SPACING|SPREAD|"+
|
||||
"SQRT|SUM|SYSTEM_CLOCK|TAN|TANH|TINY|TRAILZ|TRANSFER|TRANSPOSE|TRIM|UBOUND|UNPACK|VERIFY"
|
||||
);
|
||||
|
||||
var storageType = (
|
||||
"logical|character|integer|real|type|" +
|
||||
"LOGICAL|CHARACTER|INTEGER|REAL|TYPE"
|
||||
);
|
||||
|
||||
var storageModifiers = (
|
||||
"allocatable|dimension|intent|parameter|pointer|target|private|public|" +
|
||||
"ALLOCATABLE|DIMENSION|INTENT|PARAMETER|POINTER|TARGET|PRIVATE|PUBLIC"
|
||||
);
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"invalid.deprecated": "debugger",
|
||||
"support.function": builtinFunctions,
|
||||
"constant.language": builtinConstants,
|
||||
"keyword": keywords,
|
||||
"keyword.operator": keywordOperators,
|
||||
"storage.type": storageType,
|
||||
"storage.modifier" : storageModifiers
|
||||
}, "identifier");
|
||||
|
||||
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
|
||||
|
||||
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
||||
var binInteger = "(?:0[bB][01]+)";
|
||||
var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
|
||||
|
||||
var exponent = "(?:[eE][+-]?\\d+)";
|
||||
var fraction = "(?:\\.\\d+)";
|
||||
var intPart = "(?:\\d+)";
|
||||
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
|
||||
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||
|
||||
var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment",
|
||||
regex : "!.*$"
|
||||
}, {
|
||||
token : "string", // multi line """ string start
|
||||
regex : strPre + '"{3}',
|
||||
next : "qqstring3"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : strPre + '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // multi line ''' string start
|
||||
regex : strPre + "'{3}",
|
||||
next : "qstring3"
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : strPre + "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "constant.numeric", // imaginary
|
||||
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : floatNumber
|
||||
}, {
|
||||
token : "constant.numeric", // long integer
|
||||
regex : integer + "[lL]\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // integer
|
||||
regex : integer + "\\b"
|
||||
}, {
|
||||
token : "keyword", // pre-compiler directives
|
||||
regex : "#\\s*(?:include|import|define|undef|INCLUDE|IMPORT|DEFINE|UNDEF)\\b"
|
||||
}, {
|
||||
token : "keyword", // special case pre-compiler directive
|
||||
regex : "#\\s*(?:endif|ifdef|else|elseif|ifndef|ENDIF|IFDEF|ELSE|ELSEIF|IFNDEF)\\b"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\[\\(\\{]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\]\\)\\}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
} ],
|
||||
"qqstring3" : [ {
|
||||
token : "constant.language.escape",
|
||||
regex : stringEscape
|
||||
}, {
|
||||
token : "string", // multi line """ string end
|
||||
regex : '"{3}',
|
||||
next : "start"
|
||||
}, {
|
||||
defaultToken : "string"
|
||||
} ],
|
||||
"qstring3" : [ {
|
||||
token : "constant.language.escape",
|
||||
regex : stringEscape
|
||||
}, {
|
||||
token : "string", // multi line """ string end
|
||||
regex : '"{3}',
|
||||
next : "start"
|
||||
}, {
|
||||
defaultToken : "string"
|
||||
} ],
|
||||
"qqstring" : [{
|
||||
token : "constant.language.escape",
|
||||
regex : stringEscape
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}],
|
||||
"qstring" : [{
|
||||
token : "constant.language.escape",
|
||||
regex : stringEscape
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(FortranHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.FortranHighlightRules = FortranHighlightRules;
|
||||
});
|
|
@ -13,8 +13,6 @@ var Mode = function() {
|
|||
HtmlMode.call(this);
|
||||
this.HighlightRules = HandlebarsHighlightRules;
|
||||
this.$behaviour = new HtmlBehaviour();
|
||||
|
||||
this.foldingRules = new HtmlFoldMode();
|
||||
};
|
||||
|
||||
oop.inherits(Mode, HtmlMode);
|
||||
|
|
|
@ -216,7 +216,7 @@ var attributeMap = {
|
|||
"label": {"form": 1, "for": 1},
|
||||
"input": {
|
||||
"type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
|
||||
"accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
|
||||
"accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
|
||||
"button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
|
||||
"select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
|
||||
"datalist": {},
|
||||
|
|
|
@ -99,7 +99,7 @@ var HtmlHighlightRules = function() {
|
|||
});
|
||||
|
||||
this.embedTagRules(CssHighlightRules, "css-", "style");
|
||||
this.embedTagRules(new JavaScriptHighlightRules({noJSX: true}).getRules(), "js-", "script");
|
||||
this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
|
||||
|
||||
if (this.constructor === HtmlHighlightRules)
|
||||
this.normalizeRules();
|
||||
|
|
|
@ -383,7 +383,7 @@ var JavaScriptHighlightRules = function(options) {
|
|||
}]
|
||||
});
|
||||
|
||||
if (!options || !options.noJSX)
|
||||
if (!options || options.jsx != false)
|
||||
JSX.call(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
|||
var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
|
||||
|
||||
// var start = new Date();
|
||||
lint(value, this.options);
|
||||
lint(value, this.options, this.options.globals);
|
||||
var results = lint.errors;
|
||||
|
||||
var errorAdded = false
|
||||
|
|
|
@ -846,7 +846,7 @@ var PhpLangHighlightRules = function() {
|
|||
);
|
||||
|
||||
var builtinConstants = lang.arrayToMap(
|
||||
('true|false|null|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__').split('|')
|
||||
('true|TRUE|false|FALSE|null|NULL|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__').split('|')
|
||||
);
|
||||
|
||||
var builtinVariables = lang.arrayToMap(
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var RazorHighlightRules = require("./razor_highlight_rules").RazorHighlightRules;
|
||||
var RazorCompletions = require("./razor_completions").RazorCompletions;
|
||||
var HtmlCompletions = require("./html_completions").HtmlCompletions;
|
||||
|
||||
var Mode = function() {
|
||||
HtmlMode.call(this);
|
||||
this.$highlightRules = new RazorHighlightRules();
|
||||
this.$completer = new RazorCompletions();
|
||||
this.$htmlCompleter = new HtmlCompletions();
|
||||
};
|
||||
oop.inherits(Mode, HtmlMode);
|
||||
|
||||
(function() {
|
||||
this.getCompletions = function(state, session, pos, prefix) {
|
||||
var razorToken = this.$completer.getCompletions(state, session, pos, prefix);
|
||||
var htmlToken = this.$htmlCompleter.getCompletions(state, session, pos, prefix);
|
||||
return razorToken.concat(htmlToken);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
return null;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/razor";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
|
@ -0,0 +1,112 @@
|
|||
/* ***** 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 TokenIterator = require("../token_iterator").TokenIterator;
|
||||
|
||||
var keywords = [
|
||||
"abstract", "as", "base", "bool",
|
||||
"break", "byte", "case", "catch",
|
||||
"char", "checked", "class", "const",
|
||||
"continue", "decimal", "default", "delegate",
|
||||
"do", "double","else","enum",
|
||||
"event", "explicit", "extern", "false",
|
||||
"finally", "fixed", "float", "for",
|
||||
"foreach", "goto", "if", "implicit",
|
||||
"in", "int", "interface", "internal",
|
||||
"is", "lock", "long", "namespace",
|
||||
"new", "null", "object", "operator",
|
||||
"out", "override", "params", "private",
|
||||
"protected", "public", "readonly", "ref",
|
||||
"return", "sbyte", "sealed", "short",
|
||||
"sizeof", "stackalloc", "static", "string",
|
||||
"struct", "switch", "this", "throw",
|
||||
"true", "try", "typeof", "uint",
|
||||
"ulong", "unchecked", "unsafe", "ushort",
|
||||
"using", "var", "virtual", "void",
|
||||
"volatile", "while"];
|
||||
|
||||
var shortHands = [
|
||||
"Html", "Model", "Url", "Layout"
|
||||
];
|
||||
|
||||
var RazorCompletions = function() {
|
||||
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.getCompletions = function(state, session, pos, prefix) {
|
||||
|
||||
if(state.lastIndexOf("razor-short-start") == -1 && state.lastIndexOf("razor-block-start") == -1)
|
||||
return [];
|
||||
|
||||
var token = session.getTokenAt(pos.row, pos.column);
|
||||
if (!token)
|
||||
return [];
|
||||
|
||||
if(state.lastIndexOf("razor-short-start") != -1) {
|
||||
return this.getShortStartCompletions(state, session, pos, prefix);
|
||||
}
|
||||
|
||||
if(state.lastIndexOf("razor-block-start") != -1) {
|
||||
return this.getKeywordCompletions(state, session, pos, prefix);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
this.getShortStartCompletions = function(state, session, pos, prefix) {
|
||||
return shortHands.map(function(element){
|
||||
return {
|
||||
value: element,
|
||||
meta: "keyword",
|
||||
score: Number.MAX_VALUE
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
this.getKeywordCompletions = function(state, session, pos, prefix) {
|
||||
return shortHands.concat(keywords).map(function(element){
|
||||
return {
|
||||
value: element,
|
||||
meta: "keyword",
|
||||
score: Number.MAX_VALUE
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
}).call(RazorCompletions.prototype);
|
||||
|
||||
exports.RazorCompletions = RazorCompletions;
|
||||
|
||||
});
|
|
@ -0,0 +1,160 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||
var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
|
||||
|
||||
var blockPrefix = 'razor-block-';
|
||||
var RazorLangHighlightRules = function() {
|
||||
CSharpHighlightRules.call(this);
|
||||
|
||||
var processPotentialCallback = function(value, stackItem) {
|
||||
if (typeof stackItem === "function")
|
||||
return stackItem(value);
|
||||
|
||||
return stackItem;
|
||||
};
|
||||
|
||||
var inBraces = 'in-braces';
|
||||
this.$rules.start.unshift({
|
||||
regex: '[\\[({]',
|
||||
onMatch: function(value, state, stack) {
|
||||
var prefix = /razor-[^\-]+-/.exec(state)[0];
|
||||
|
||||
stack.unshift(value);
|
||||
stack.unshift(prefix + inBraces);
|
||||
this.next = prefix + inBraces;
|
||||
return 'paren.lparen';
|
||||
}
|
||||
}, {
|
||||
start: "@\\*",
|
||||
end: "\\*@",
|
||||
token: "comment"
|
||||
});
|
||||
|
||||
var parentCloseMap = {
|
||||
'{': '}',
|
||||
'[': ']',
|
||||
'(': ')'
|
||||
};
|
||||
|
||||
this.$rules[inBraces] = lang.deepCopy(this.$rules.start);
|
||||
this.$rules[inBraces].unshift({
|
||||
regex: '[\\])}]',
|
||||
onMatch: function(value, state, stack) {
|
||||
var open = stack[1];
|
||||
if (parentCloseMap[open] !== value)
|
||||
return 'invalid.illegal';
|
||||
|
||||
stack.shift(); // exit in-braces block
|
||||
stack.shift(); // exit brace marker
|
||||
this.next = processPotentialCallback(value, stack[0]) || 'start';
|
||||
return 'paren.rparen';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
oop.inherits(RazorLangHighlightRules, CSharpHighlightRules);
|
||||
|
||||
var RazorHighlightRules = function() {
|
||||
HtmlHighlightRules.call(this);
|
||||
|
||||
// 'Blocks': @{}, @(), @functions{}
|
||||
|
||||
var blockStartRule = {
|
||||
regex: '@[({]|@functions{',
|
||||
onMatch: function(value, state, stack) {
|
||||
stack.unshift(value);
|
||||
stack.unshift('razor-block-start');
|
||||
this.next = 'razor-block-start';
|
||||
return 'punctuation.block.razor';
|
||||
}
|
||||
};
|
||||
|
||||
var blockEndMap = {
|
||||
'@{': '}',
|
||||
'@(': ')',
|
||||
'@functions{':'}'
|
||||
};
|
||||
|
||||
var blockEndRule = {
|
||||
regex: '[})]',
|
||||
onMatch: function(value, state, stack) {
|
||||
var blockStart = stack[1];
|
||||
if (blockEndMap[blockStart] !== value)
|
||||
return 'invalid.illegal';
|
||||
|
||||
stack.shift(); // exit razor block
|
||||
stack.shift(); // remove block type marker
|
||||
this.next = stack.shift() || 'start';
|
||||
return 'punctuation.block.razor';
|
||||
}
|
||||
};
|
||||
|
||||
// Short: @Abc.Cde(Xyz).Ef
|
||||
|
||||
var shortStartRule = {
|
||||
regex: "@(?![{(])",
|
||||
onMatch: function(value, state, stack) {
|
||||
stack.unshift("razor-short-start");
|
||||
this.next = "razor-short-start";
|
||||
return 'punctuation.short.razor';
|
||||
}
|
||||
};
|
||||
|
||||
var shortEndRule = {
|
||||
token: "",
|
||||
regex: "(?=[^A-Za-z_\\.()\\[\\]])",
|
||||
next: 'pop'
|
||||
};
|
||||
|
||||
// Control flow: @if, etc
|
||||
|
||||
var ifStartRule = {
|
||||
regex: "@(?=if)",
|
||||
onMatch: function(value, state, stack) {
|
||||
stack.unshift(function(value) {
|
||||
if (value !== '}')
|
||||
return 'start';
|
||||
|
||||
return stack.shift() || 'start';
|
||||
});
|
||||
this.next = 'razor-block-start';
|
||||
return 'punctuation.control.razor';
|
||||
}
|
||||
};
|
||||
|
||||
// Combined:
|
||||
|
||||
var razorStartRules = [
|
||||
{
|
||||
start: "@\\*",
|
||||
end: "\\*@",
|
||||
token: "comment"
|
||||
},
|
||||
{
|
||||
token: ["meta.directive.razor", "text", "identifier"],
|
||||
regex: "^(\\s*@model)(\\s+)(.+)$"
|
||||
},
|
||||
blockStartRule,
|
||||
//ifStartRule,
|
||||
shortStartRule
|
||||
];
|
||||
|
||||
for (var key in this.$rules)
|
||||
this.$rules[key].unshift.apply(this.$rules[key], razorStartRules);
|
||||
|
||||
this.embedRules(RazorLangHighlightRules, "razor-block-", [blockEndRule], ["start"]);
|
||||
this.embedRules(RazorLangHighlightRules, "razor-short-", [shortEndRule], ["start"]);
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(RazorHighlightRules, HtmlHighlightRules);
|
||||
|
||||
exports.RazorHighlightRules = RazorHighlightRules;
|
||||
exports.RazorLangHighlightRules = RazorLangHighlightRules;
|
||||
});
|
|
@ -0,0 +1,51 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2015, Robin Jarry
|
||||
* 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 RSTHighlightRules = require("./rst_highlight_rules").RSTHighlightRules;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = RSTHighlightRules;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.type = "text";
|
||||
|
||||
this.$id = "ace/mode/rst";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
|
@ -0,0 +1,296 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2015, Robin Jarry
|
||||
* 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 lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var RSTHighlightRules = function() {
|
||||
|
||||
var tokens = {
|
||||
title: "markup.heading",
|
||||
list: "markup.heading",
|
||||
table: "constant",
|
||||
directive: "keyword.operator",
|
||||
entity: "string",
|
||||
link: "markup.underline.list",
|
||||
bold: "markup.bold",
|
||||
italic: "markup.italic",
|
||||
literal: "support.function",
|
||||
comment: "comment"
|
||||
};
|
||||
|
||||
var startStringPrefix = "(^|\\s|[\"'(<\\[{\\-/:])";
|
||||
var endStringSuffix = "(?:$|(?=\\s|[\\\\.,;!?\\-/:\"')>\\]}]))";
|
||||
|
||||
this.$rules = {
|
||||
"start": [
|
||||
/* NB: Only the underline of the heading is highlighted.
|
||||
* ACE tokenizer does not allow backtracking, the underlined text of the
|
||||
* heading cannot be highlighted. */
|
||||
{
|
||||
token : tokens.title,
|
||||
regex : "(^)([\\=\\-`:\\.'\"~\\^_\\*\\+#])(\\2{2,}\\s*$)"
|
||||
},
|
||||
/* Generic directive syntax (e.g. .. code-block:: c)
|
||||
* All of the directive body is highlighted as a code block. */
|
||||
{
|
||||
token : ["text", tokens.directive, tokens.literal],
|
||||
regex : "(^\\s*\\.\\. )([^: ]+::)(.*$)",
|
||||
next : "codeblock"
|
||||
},
|
||||
{
|
||||
token : tokens.directive,
|
||||
regex : "::$",
|
||||
next : "codeblock"
|
||||
},
|
||||
/* Link/anchor definitions */
|
||||
{
|
||||
token : [tokens.entity, tokens.link],
|
||||
regex : "(^\\.\\. _[^:]+:)(.*$)"
|
||||
},
|
||||
{
|
||||
token : [tokens.entity, tokens.link],
|
||||
regex : "(^__ )(https?://.*$)"
|
||||
},
|
||||
/* Footnote definition */
|
||||
{
|
||||
token : tokens.entity,
|
||||
regex : "^\\.\\. \\[[^\\]]+\\] "
|
||||
},
|
||||
/* Comment block start */
|
||||
{
|
||||
token : tokens.comment,
|
||||
regex : "^\\.\\. .*$",
|
||||
next : "comment"
|
||||
},
|
||||
/* List items */
|
||||
{
|
||||
token : tokens.list,
|
||||
regex : "^\\s*[\\*\\+-] "
|
||||
},
|
||||
{
|
||||
token : tokens.list,
|
||||
regex : "^\\s*(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\. "
|
||||
},
|
||||
{
|
||||
token : tokens.list,
|
||||
regex : "^\\s*\\(?(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\) "
|
||||
},
|
||||
/* "Simple" tables */
|
||||
{
|
||||
token : tokens.table,
|
||||
regex : "^={2,}(?: +={2,})+$"
|
||||
},
|
||||
/* "Grid" tables */
|
||||
{
|
||||
token : tokens.table,
|
||||
regex : "^\\+-{2,}(?:\\+-{2,})+\\+$"
|
||||
},
|
||||
{
|
||||
token : tokens.table,
|
||||
regex : "^\\+={2,}(?:\\+={2,})+\\+$"
|
||||
},
|
||||
/* Inline markup */
|
||||
{
|
||||
token : ["text", tokens.literal],
|
||||
regex : startStringPrefix + "(``)(?=\\S)",
|
||||
next : "code"
|
||||
},
|
||||
{
|
||||
token : ["text", tokens.bold],
|
||||
regex : startStringPrefix + "(\\*\\*)(?=\\S)",
|
||||
next : "bold"
|
||||
},
|
||||
{
|
||||
token : ["text", tokens.italic],
|
||||
regex : startStringPrefix + "(\\*)(?=\\S)",
|
||||
next : "italic"
|
||||
},
|
||||
/* Substitution reference */
|
||||
{
|
||||
token : tokens.entity,
|
||||
regex : "\\|[\\w\\-]+?\\|"
|
||||
},
|
||||
/* Link/footnote references */
|
||||
{
|
||||
token : tokens.entity,
|
||||
regex : ":[\\w-:]+:`\\S",
|
||||
next : "entity"
|
||||
},
|
||||
{
|
||||
token : ["text", tokens.entity],
|
||||
regex : startStringPrefix + "(_`)(?=\\S)",
|
||||
next : "entity"
|
||||
},
|
||||
{
|
||||
token : tokens.entity,
|
||||
regex : "_[A-Za-z0-9\\-]+?"
|
||||
},
|
||||
{
|
||||
token : ["text", tokens.link],
|
||||
regex : startStringPrefix + "(`)(?=\\S)",
|
||||
next : "link"
|
||||
},
|
||||
{
|
||||
token : tokens.link,
|
||||
regex : "[A-Za-z0-9\\-]+?__?"
|
||||
},
|
||||
{
|
||||
token : tokens.link,
|
||||
regex : "\\[[^\\]]+?\\]_"
|
||||
},
|
||||
{
|
||||
token : tokens.link,
|
||||
regex : "https?://\\S+"
|
||||
},
|
||||
/* "Grid" tables column separator
|
||||
* This is at the end to make it lower priority over all other rules. */
|
||||
{
|
||||
token : tokens.table,
|
||||
regex : "\\|"
|
||||
}
|
||||
],
|
||||
|
||||
/* This state is used for all directive bodies and literal blocks.
|
||||
* The parser returns to the "start" state when reaching the first
|
||||
* non-empty line that does not start with at least one space. */
|
||||
"codeblock": [
|
||||
{
|
||||
token : tokens.literal,
|
||||
regex : "^ +.+$",
|
||||
next : "codeblock"
|
||||
},
|
||||
{
|
||||
token : tokens.literal,
|
||||
regex : '^$',
|
||||
next: "codeblock"
|
||||
},
|
||||
{
|
||||
token : "empty",
|
||||
regex : "",
|
||||
next : "start"
|
||||
}
|
||||
],
|
||||
|
||||
/* Inline code
|
||||
* The parser returns to the "start" state when reaching "``" */
|
||||
"code": [
|
||||
{
|
||||
token : tokens.literal,
|
||||
regex : "\\S``" + endStringSuffix,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
defaultToken: tokens.literal
|
||||
}
|
||||
],
|
||||
|
||||
/* Bold (strong) text
|
||||
* The parser returns to the "start" state when reaching "**" */
|
||||
"bold": [
|
||||
{
|
||||
token : tokens.bold,
|
||||
regex : "\\S\\*\\*" + endStringSuffix,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
defaultToken: tokens.bold
|
||||
}
|
||||
],
|
||||
|
||||
/* Italic (emphasis) text
|
||||
* The parser returns to the "start" state when reaching "*" */
|
||||
"italic": [
|
||||
{
|
||||
token : tokens.italic,
|
||||
regex : "\\S\\*" + endStringSuffix,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
defaultToken: tokens.italic
|
||||
}
|
||||
],
|
||||
|
||||
/* Explicit role/class text or link anchor definition
|
||||
* The parser returns to the "start" state when reaching "`" */
|
||||
"entity": [
|
||||
{
|
||||
token : tokens.entity,
|
||||
regex : "\\S`" + endStringSuffix,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
defaultToken: tokens.entity
|
||||
}
|
||||
],
|
||||
|
||||
/* Link reference
|
||||
* The parser returns to the "start" state when reaching "`_" or "`__" */
|
||||
"link": [
|
||||
{
|
||||
token : tokens.link,
|
||||
regex : "\\S`__?" + endStringSuffix,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
defaultToken: tokens.link
|
||||
}
|
||||
],
|
||||
|
||||
/* Comment block.
|
||||
* The parser returns to the "start" state when reaching the first
|
||||
* non-empty line that does not start with at least one space. */
|
||||
"comment": [
|
||||
{
|
||||
token : tokens.comment,
|
||||
regex : "^ +.+$",
|
||||
next : "comment"
|
||||
},
|
||||
{
|
||||
token : tokens.comment,
|
||||
regex : '^$',
|
||||
next: "comment"
|
||||
},
|
||||
{
|
||||
token : "empty",
|
||||
regex : "",
|
||||
next : "start"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
oop.inherits(RSTHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.RSTHighlightRules = RSTHighlightRules;
|
||||
});
|
|
@ -36,7 +36,7 @@ define(function(require, exports, module) {
|
|||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var stringEscape = /\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source;
|
||||
var stringEscape = /\\(?:[nrt0'"\\]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source;
|
||||
var RustHighlightRules = function() {
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
|
|
@ -33,7 +33,7 @@ define(function(require, exports, module) {
|
|||
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
var Behaviour = require("./behaviour").Behaviour;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var unicode = require("../unicode");
|
||||
var lang = require("../lib/lang");
|
||||
var TokenIterator = require("../token_iterator").TokenIterator;
|
||||
|
@ -41,10 +41,10 @@ var Range = require("../range").Range;
|
|||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = TextHighlightRules;
|
||||
this.$behaviour = new Behaviour();
|
||||
};
|
||||
|
||||
(function() {
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
|
||||
this.tokenRe = new RegExp("^["
|
||||
+ unicode.packages.L
|
||||
|
@ -62,7 +62,7 @@ var Mode = function() {
|
|||
|
||||
this.getTokenizer = function() {
|
||||
if (!this.$tokenizer) {
|
||||
this.$highlightRules = this.$highlightRules || new this.HighlightRules();
|
||||
this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig);
|
||||
this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
|
||||
}
|
||||
return this.$tokenizer;
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var tsMode = require("./typescript").Mode;
|
||||
|
||||
var Mode = function() {
|
||||
tsMode.call(this);
|
||||
this.$highlightRuleConfig = {jsx: true};
|
||||
};
|
||||
oop.inherits(Mode, tsMode);
|
||||
|
||||
(function() {
|
||||
this.$id = "ace/mode/tsx";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
|
@ -86,7 +86,7 @@ var TypeScriptHighlightRules = function(options) {
|
|||
}
|
||||
];
|
||||
|
||||
var JSRules = new JavaScriptHighlightRules({jsx: options && options.jsx}).getRules();
|
||||
var JSRules = new JavaScriptHighlightRules({jsx: (options && options.jsx) == true}).getRules();
|
||||
|
||||
JSRules.start = tsRules.concat(JSRules.start);
|
||||
this.$rules = JSRules;
|
||||
|
|
|
@ -35,6 +35,7 @@ var oop = require("./lib/oop");
|
|||
var dom = require("./lib/dom");
|
||||
var event = require("./lib/event");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var MAX_SCROLL_H = 0x8000;
|
||||
|
||||
/**
|
||||
* An abstract class representing a native scrollbar control.
|
||||
|
@ -70,6 +71,7 @@ var ScrollBar = function(parent) {
|
|||
this.setVisible = function(isVisible) {
|
||||
this.element.style.display = isVisible ? "" : "none";
|
||||
this.isVisible = isVisible;
|
||||
this.coeff = 1;
|
||||
};
|
||||
}).call(ScrollBar.prototype);
|
||||
|
||||
|
@ -114,7 +116,7 @@ oop.inherits(VScrollBar, ScrollBar);
|
|||
**/
|
||||
this.onScroll = function() {
|
||||
if (!this.skipEvent) {
|
||||
this.scrollTop = this.element.scrollTop;
|
||||
this.scrollTop = this.element.scrollTop / this.coeff;
|
||||
this._emit("scroll", {data: this.scrollTop});
|
||||
}
|
||||
this.skipEvent = false;
|
||||
|
@ -141,15 +143,18 @@ oop.inherits(VScrollBar, ScrollBar);
|
|||
* @param {Number} height The new inner height
|
||||
* @deprecated Use setScrollHeight instead
|
||||
**/
|
||||
this.setInnerHeight = function(height) {
|
||||
this.inner.style.height = height + "px";
|
||||
};
|
||||
|
||||
this.setInnerHeight =
|
||||
/**
|
||||
* Sets the scroll height of the scroll bar, in pixels.
|
||||
* @param {Number} height The new scroll height
|
||||
**/
|
||||
this.setScrollHeight = function(height) {
|
||||
if (height > MAX_SCROLL_H) {
|
||||
this.coeff = MAX_SCROLL_H / height;
|
||||
height = MAX_SCROLL_H;
|
||||
} else if (this.coeff != 1) {
|
||||
this.coeff = 1
|
||||
}
|
||||
this.inner.style.height = height + "px";
|
||||
};
|
||||
|
||||
|
@ -162,7 +167,8 @@ oop.inherits(VScrollBar, ScrollBar);
|
|||
// this.element.scrollTop != scrollTop which makes page to scroll up.
|
||||
if (this.scrollTop != scrollTop) {
|
||||
this.skipEvent = true;
|
||||
this.scrollTop = this.element.scrollTop = scrollTop;
|
||||
this.scrollTop = scrollTop;
|
||||
this.element.scrollTop = scrollTop * this.coeff;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = require("../requirejs/text!./drools.snippets");
|
||||
exports.scope = "drools";
|
||||
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
snippet rule
|
||||
rule "${1?:rule_name}"
|
||||
when
|
||||
${2:// when...}
|
||||
then
|
||||
${3:// then...}
|
||||
end
|
||||
|
||||
snippet query
|
||||
query ${1?:query_name}
|
||||
${2:// find}
|
||||
end
|
||||
|
||||
snippet declare
|
||||
declare ${1?:type_name}
|
||||
${2:// attributes}
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = require("../requirejs/text!./.snippets");
|
||||
exports.scope = "";
|
||||
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = require("../requirejs/text!./fortran.snippets");
|
||||
exports.scope = "fortran";
|
||||
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = require("../requirejs/text!./fsharp.snippets");
|
||||
exports.scope = "fsharp";
|
||||
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = require("../requirejs/text!./razor.snippets");
|
||||
exports.scope = "razor";
|
||||
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
snippet if
|
||||
(${1} == ${2}) {
|
||||
${3}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
.ace-gruvbox .ace_gutter {
|
||||
background: #282828;
|
||||
color: #a89984;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_print-margin {
|
||||
width: 1px;
|
||||
background: #555651
|
||||
}
|
||||
|
||||
.ace-gruvbox {
|
||||
background-color: #282828;
|
||||
color: #ebdbb2
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_cursor {
|
||||
color: #F8F8F0
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_marker-layer .ace_selection {
|
||||
background: #3c3836;
|
||||
}
|
||||
|
||||
.ace-gruvbox.ace_multiselect .ace_selection.ace_start {
|
||||
box-shadow: 0 0 3px 0px #3c3836;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_marker-layer .ace_step {
|
||||
background: #32302f;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_marker-layer .ace_bracket {
|
||||
margin: -1px 0 0 -1px;
|
||||
border: 1px solid #f38019;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_marker-layer .ace_active-line {
|
||||
background: #3c3836;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_gutter-active-line {
|
||||
background-color: #3c3836;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_marker-layer .ace_selected-word {
|
||||
border: 1px solid #3c3836;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_invisible {
|
||||
color: #3c3836
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_entity.ace_name.ace_tag,
|
||||
.ace-gruvbox .ace_keyword,
|
||||
.ace-gruvbox .ace_meta.ace_tag,
|
||||
.ace-gruvbox .ace_storage {
|
||||
color: #fb4934
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_punctuation,
|
||||
.ace-gruvbox .ace_punctuation.ace_tag {
|
||||
color: #fff
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_constant.ace_character,
|
||||
.ace-gruvbox .ace_constant.ace_language,
|
||||
.ace-gruvbox .ace_constant.ace_numeric,
|
||||
.ace-gruvbox .ace_constant.ace_other {
|
||||
color: #83a598
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_invalid {
|
||||
color: #F8F8F0;
|
||||
background-color: #d3869b;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_invalid.ace_deprecated {
|
||||
color: #F8F8F0;
|
||||
background-color: #83a598;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_support.ace_constant,
|
||||
.ace-gruvbox .ace_support.ace_function {
|
||||
color: #83a598
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_fold {
|
||||
background-color: #a3aa20;
|
||||
border-color: #F8F8F2
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_storage.ace_type,
|
||||
.ace-gruvbox .ace_support.ace_class,
|
||||
.ace-gruvbox .ace_support.ace_type {
|
||||
font-style: italic;
|
||||
color: #ebaa27
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_entity.ace_name.ace_function,
|
||||
.ace-gruvbox .ace_entity.ace_other,
|
||||
.ace-gruvbox .ace_entity.ace_other.ace_attribute-name,
|
||||
.ace-gruvbox .ace_variable {
|
||||
color: #a3aa20
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_variable.ace_parameter {
|
||||
font-style: italic;
|
||||
color: #fabd2f
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_string {
|
||||
color: #ebdbb2;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_comment {
|
||||
color: #665c54;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.ace-gruvbox .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
exports.isDark = true;
|
||||
exports.cssClass = "ace-gruvbox";
|
||||
exports.cssText = require("../requirejs/text!./gruvbox.css");
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
dom.importCssString(exports.cssText, exports.cssClass);
|
||||
});
|
|
@ -1033,7 +1033,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
minHeight : minHeight,
|
||||
maxHeight : maxHeight,
|
||||
offset : offset,
|
||||
gutterOffset : Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)),
|
||||
gutterOffset : lineHeight ? Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)) : 0,
|
||||
height : this.$size.scrollerHeight
|
||||
};
|
||||
|
||||
|
|
|
@ -258,6 +258,7 @@ var EditableTree = function(tree) {
|
|||
|
||||
var ace = this.ace;
|
||||
this.ace = null;
|
||||
this.$lastAce = ace;
|
||||
ace.renderer.freeze();
|
||||
setTimeout(function() {
|
||||
// doing this after timeout to allow rename event focus something else
|
||||
|
@ -267,6 +268,7 @@ var EditableTree = function(tree) {
|
|||
ace.wrapper.parentNode.removeChild(ace.wrapper);
|
||||
if (wasFocused)
|
||||
this.tree.focus();
|
||||
this.$lastAce = null;
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
@ -386,6 +388,7 @@ var EditableTree = function(tree) {
|
|||
|
||||
var val = this.ace.getValue();
|
||||
|
||||
this._destroyEditor();
|
||||
|
||||
if (!cancel && this.origVal !== val) {
|
||||
this.tree._emit("rename", {
|
||||
|
@ -396,8 +399,6 @@ var EditableTree = function(tree) {
|
|||
});
|
||||
this.tree.provider._signal("change");
|
||||
}
|
||||
|
||||
this._destroyEditor();
|
||||
};
|
||||
|
||||
}).call(EditableTree.prototype);
|
||||
|
|
|
@ -123,6 +123,7 @@ exports.generateKeyPair = function(email, callback) {
|
|||
var phrase = "";
|
||||
|
||||
var command = "ssh-keygen -t rsa " +
|
||||
"-b 4096 " +
|
||||
"-f \"" + filename + "\" " +
|
||||
"-P \"" + phrase + "\" " +
|
||||
"-C \"" + email + "\" ";
|
||||
|
|
|
@ -1562,7 +1562,7 @@ module.exports = function setup(fsOptions) {
|
|||
// todo add resize event
|
||||
proc.emit("data", {rows: rows, cols: cols});
|
||||
|
||||
if (!tmuxWarned) {
|
||||
if (!tmuxWarned && !isWin) {
|
||||
if (/v0\.([123456789]\..*|10\.(0|1|2[0-7]))/.test(process.version)) {
|
||||
proc.emit("data", {
|
||||
message: "Wrong Node.js version: " + process.version,
|
||||
|
@ -2020,7 +2020,8 @@ module.exports = function setup(fsOptions) {
|
|||
};
|
||||
|
||||
this.resize = function() {
|
||||
return pty.resize.apply(pty, arguments);
|
||||
if (!exited)
|
||||
return pty.resize.apply(pty, arguments);
|
||||
};
|
||||
|
||||
// this.acknowledgeWrite = function(callback) {
|
||||
|
|
|
@ -437,7 +437,7 @@ function Worker(vfs) {
|
|||
var keys = Object.keys(meta || {});
|
||||
for (var i = 0, l = keys.length; i < l; i++) {
|
||||
var key = keys[i];
|
||||
if (!meta[key])
|
||||
if (meta[key] == undefined)
|
||||
continue;
|
||||
switch (key) {
|
||||
case "stream": token.stream = storeStream(meta.stream); break;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "c9",
|
||||
"description": "New Cloud9 Client",
|
||||
"version": "3.1.2032",
|
||||
"version": "3.1.2165",
|
||||
"author": "Ajax.org B.V. <info@ajax.org>",
|
||||
"private": true,
|
||||
"main": "bin/c9",
|
||||
|
@ -67,7 +67,7 @@
|
|||
"c9.ide.language.javascript.infer": "#18acb93a3a",
|
||||
"c9.ide.language.jsonalyzer": "#4b329741b1",
|
||||
"c9.ide.language.codeintel": "#2b18c5ccb1",
|
||||
"c9.ide.collab": "#728ad2bde2",
|
||||
"c9.ide.collab": "#33263e74c3",
|
||||
"c9.ide.local": "#10eb45842a",
|
||||
"c9.ide.find": "#e33fbaed2f",
|
||||
"c9.ide.find.infiles": "#c0a13737ef",
|
||||
|
@ -108,8 +108,8 @@
|
|||
"c9.ide.run": "#6bd4996a4e",
|
||||
"c9.ide.run.build": "#0598fff697",
|
||||
"c9.ide.run.debug.xdebug": "#9956689819",
|
||||
"c9.ide.save": "#4cda35bfdb",
|
||||
"c9.ide.scm": "#219b66019a",
|
||||
"c9.ide.save": "#25a63f31e2",
|
||||
"c9.ide.scm": "#637a68cd04",
|
||||
"c9.ide.terminal.monitor": "#affa33572f",
|
||||
"c9.ide.test": "#102942ae4e",
|
||||
"c9.ide.test.mocha": "#fc053b23d2",
|
||||
|
|
|
@ -84,6 +84,9 @@ function plugin(options, imports, register) {
|
|||
}
|
||||
|
||||
function _sendRequest(raygunClient, err, req) {
|
||||
if (typeof err == "string")
|
||||
err = new Error(err);
|
||||
|
||||
var parsedUrl = url.parse(req.url, false);
|
||||
var ip = req.remoteAddress;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
|
|||
|
||||
describe('proc', function() {
|
||||
describe('spawn()', function() {
|
||||
this.timeout(4000);
|
||||
this.timeout(10000);
|
||||
|
||||
it("should spawn a child process", function(done) {
|
||||
var args = ["-e", "process.stdin.pipe(process.stdout);try{process.stdin.resume()}catch(e) {};"];
|
||||
|
@ -66,8 +66,8 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
|
|||
});
|
||||
});
|
||||
|
||||
//should test the kill() method - which is broken now
|
||||
//Another test - see that cwd defaults to the root vfs dir when resolve is set to true
|
||||
// should test the kill() method - which is broken now
|
||||
// Another test - see that cwd defaults to the root vfs dir when resolve is set to true
|
||||
});
|
||||
describe('execFile()', function() {
|
||||
this.timeout(10000);
|
||||
|
@ -101,8 +101,19 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
|
|||
});
|
||||
});
|
||||
|
||||
//should test the kill() method - which is broken now
|
||||
//Another test - see that cwd defaults to the root vfs dir when resolve is set to true
|
||||
it('should pass stdout and stderr', function(done) {
|
||||
proc.execFile("node", {
|
||||
args: ["-v"]
|
||||
}, function(e, stdout, stderr) {
|
||||
expect(stdout[0]).to.equal("v");
|
||||
expect(stderr).to.equal("");
|
||||
expect(e).to.not.ok;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// should test the kill() method - which is broken now
|
||||
// Another test - see that cwd defaults to the root vfs dir when resolve is set to true
|
||||
});
|
||||
describe('pty()', function() {
|
||||
this.timeout(30000);
|
||||
|
|
|
@ -9,14 +9,13 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
main.consumes = [
|
||||
"Plugin", "http"
|
||||
"Plugin",
|
||||
];
|
||||
main.provides = ["error_handler"];
|
||||
return main;
|
||||
|
||||
function main(options, imports, register) {
|
||||
var Plugin = imports.Plugin;
|
||||
var http = imports.http;
|
||||
|
||||
/***** Initialization *****/
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
.btn-switcher {
|
||||
.user-select(none);
|
||||
|
||||
-webkit-display: flex;
|
||||
display: flex;
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
cursor: default;
|
||||
line-height: 19px;
|
||||
font-size: @preview-chooser-font-size;
|
||||
font-weight: @preview-chooser-font-weight;
|
||||
color: ;
|
||||
|
@ -46,6 +48,5 @@
|
|||
.btn-switcherIcon {
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 25px;
|
||||
padding-top: 5px;
|
||||
background-position: 5px 6px;
|
||||
background-position: 5px 50%
|
||||
}
|
|
@ -221,7 +221,7 @@ define(function(require, exports, module) {
|
|||
}]);
|
||||
|
||||
ace.onPaste = function(text) {
|
||||
this.send(text.replace(/\r\n/g, "\n"));
|
||||
this.send(text.replace(/\r\n?|\n/g, this.session.term.convertEol ? "\n" : "\r"));
|
||||
};
|
||||
|
||||
ace.setKeyboardHandler(this);
|
||||
|
|
|
@ -520,7 +520,7 @@ define(function(require, exports, module) {
|
|||
}
|
||||
|
||||
if (dirname(newpath) != dirname(path)) {
|
||||
tree.edit.ace.blur(); // TODO this shouldn't be needed when apf focus works
|
||||
tree.edit.$lastAce && tree.edit.$lastAce.blur(); // TODO this shouldn't be needed when apf focus works
|
||||
question(
|
||||
"Confirm move to a new folder",
|
||||
"move '" + e.oldValue + "' to \n" +
|
||||
|
|
|
@ -255,6 +255,13 @@ define(function(require, exports, module) {
|
|||
}, 10000);
|
||||
return;
|
||||
}
|
||||
else if (err.code == 503) {
|
||||
// service unavailable
|
||||
setTimeout(function() {
|
||||
tryNext(i);
|
||||
}, res.error.retryIn || 15000);
|
||||
return;
|
||||
}
|
||||
else if (err.code === 500 && res && res.error && res.error.cause) {
|
||||
return callback(res.error.cause.message);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
module.exports = function(vfs, options, register) {
|
||||
register(null, {
|
||||
log: function (message, callback) {
|
||||
callback = callback || function(){};
|
||||
|
||||
console.log(message);
|
||||
callback();
|
||||
}
|
||||
})
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/** Sends client side logs to vfs via the websocket connection **/
|
||||
|
||||
define(function (require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
main.consumes = ["Plugin", "ext", "c9"];
|
||||
main.provides = ["vfs.log"];
|
||||
return main;
|
||||
|
||||
function main(options, imports, register) {
|
||||
var Plugin = imports.Plugin;
|
||||
var c9 = imports.c9;
|
||||
var ext = imports.ext;
|
||||
var plugin = new Plugin("Ajax.org", main.consumes);
|
||||
|
||||
var loaded = false;
|
||||
var server = null;
|
||||
|
||||
function load() {
|
||||
if (loaded) return false;
|
||||
loaded = true;
|
||||
|
||||
ext.loadRemotePlugin("log", {
|
||||
code: require("text!./log-service.js"),
|
||||
redefine: true
|
||||
}, function(err, remote) {
|
||||
if (err) return console.error(err);
|
||||
|
||||
server = remote;
|
||||
});
|
||||
|
||||
c9.on("stateChange", function(e) {
|
||||
if (e.state & c9.NETWORK) {
|
||||
load();
|
||||
}
|
||||
else {
|
||||
loaded = false;
|
||||
server = null;
|
||||
}
|
||||
}, plugin);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function log() {
|
||||
if (!server) return console.error("Cannot log, client is offline");
|
||||
var callback = function(){};
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (typeof args[args.length-1] === "function") {
|
||||
callback = args.splice(args.length-1, 1);
|
||||
}
|
||||
|
||||
var message = "";
|
||||
args.forEach(function (arg) {
|
||||
if (typeof arg === "object") {
|
||||
return message += JSON.stringify(arg);
|
||||
}
|
||||
message += arg;
|
||||
});
|
||||
|
||||
server.log(message, callback);
|
||||
}
|
||||
|
||||
plugin.on("load", function() {
|
||||
load();
|
||||
});
|
||||
|
||||
plugin.on("unload", function() {
|
||||
loaded = false;
|
||||
server = null;
|
||||
});
|
||||
|
||||
plugin.freezePublicAPI({
|
||||
log: log
|
||||
});
|
||||
|
||||
register(null, {
|
||||
"vfs.log": plugin
|
||||
});
|
||||
}
|
||||
})
|
|
@ -146,6 +146,7 @@ define(function(require, exports, module) {
|
|||
|
||||
function rest(path, options, callback) {
|
||||
if (!vfs || !connection || connection.readyState != "open") {
|
||||
console.error("[vfs-client] Cannot perform rest action for ", path, " vfs is disconnected");
|
||||
var stub = { abort: function(){ buffer[this.id]= null; } };
|
||||
stub.id = buffer.push([path, options, callback, stub]) - 1;
|
||||
return stub;
|
||||
|
|
|
@ -176,7 +176,7 @@ function plugin(options, imports, register) {
|
|||
|
||||
api.get("/update/:path*", function(req, res, next) {
|
||||
var filename = req.params.path;
|
||||
var path = resolve(__dirname + "/../../build/output/" + filename);
|
||||
var path = resolve(__dirname + "/../../build/output/" + resolve("/" + filename));
|
||||
|
||||
var stream = fs.createReadStream(path);
|
||||
stream.on("error", function(err) {
|
||||
|
|
|
@ -94,6 +94,9 @@ require([
|
|||
var x = new EventEmitter();
|
||||
return x;
|
||||
})(),
|
||||
"vfs.log": {
|
||||
log: function(){}
|
||||
},
|
||||
anims: (function(){
|
||||
var x = new EventEmitter();
|
||||
x.animateSplitBoxNode = function(node, opt) {
|
||||
|
|
36
server.js
36
server.js
|
@ -8,8 +8,6 @@ try {
|
|||
|
||||
var path = require("path");
|
||||
var architect = require("architect");
|
||||
var optimist = require("optimist");
|
||||
var async = require("async");
|
||||
var os = require("os");
|
||||
var urls = require("c9/urls");
|
||||
var hostname = require("c9/hostname");
|
||||
|
@ -73,7 +71,9 @@ module.exports.getDefaultSettings = getDefaultSettings;
|
|||
|
||||
function main(argv, config, onLoaded) {
|
||||
var inContainer = os.hostname().match(/-\d+$/);
|
||||
|
||||
var optimist = require("optimist");
|
||||
var async = require("async");
|
||||
|
||||
var options = optimist(argv)
|
||||
.usage("Usage: $0 [CONFIG_NAME] [--help]")
|
||||
.alias("s", "settings")
|
||||
|
@ -142,6 +142,34 @@ function expandShortCuts(configs) {
|
|||
return results;
|
||||
}
|
||||
|
||||
function loadSettings(settingsName) {
|
||||
var provider = hostname.parse(os.hostname()).provider;
|
||||
var candidates = [
|
||||
path.join(__dirname, "./settings", settingsName + "-" + provider),
|
||||
path.join(__dirname, "./settings", settingsName)
|
||||
];
|
||||
|
||||
var settings, settingsModule;
|
||||
|
||||
for (var i = 0; i < candidates.length; i++) {
|
||||
var settingsPath = candidates[i];
|
||||
try {
|
||||
settingsModule = require(settingsPath);
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
settings = settingsModule();
|
||||
break;
|
||||
|
||||
}
|
||||
if (!settings)
|
||||
throw new Error("No settings found");
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
module.exports.loadSettings = loadSettings;
|
||||
|
||||
function start(configName, options, callback) {
|
||||
console.log("Starting", configName);
|
||||
|
||||
|
@ -155,7 +183,7 @@ function start(configName, options, callback) {
|
|||
if (configPath[0] !== "/")
|
||||
configPath = path.join(__dirname, "/configs/", configName);
|
||||
|
||||
var settings = require(path.join(__dirname, "./settings", settingsName))();
|
||||
var settings = loadSettings(settingsName);
|
||||
|
||||
argv.domains = argv.domains || settings.domains;
|
||||
if (settings.c9 && argv.domains)
|
||||
|
|
|
@ -63,6 +63,7 @@ module.exports = function(manifest, installPath) {
|
|||
ideBaseUrl: "http://c9.io",
|
||||
previewUrl: "/preview",
|
||||
dashboardUrl: "https://c9.io/dashboard.html",
|
||||
accountUrl: "https://c9.io/account",
|
||||
apiUrl: "/api",
|
||||
homeUrl: "/home",
|
||||
collab: false,
|
||||
|
|
Ładowanie…
Reference in New Issue