Skip to content

Commit

Permalink
Merge branch 'feature/documentation-in-code-complete' into jsinfer
Browse files Browse the repository at this point in the history
Conflicts:
	configs/default.js
  • Loading branch information
lennartcl committed Jun 2, 2012
2 parents 902333a + 9767bc8 commit e59d76e
Show file tree
Hide file tree
Showing 138 changed files with 13,223 additions and 1,855 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -17,6 +17,7 @@ aut.js
helloworld.js
.*.gz
.c9revisions
.c9search
.architect/
.sourcemint/
/mapped_packages/
Expand Down
18 changes: 15 additions & 3 deletions Makefile
Expand Up @@ -69,12 +69,24 @@ plugins-client/lib.ace/www/worker/worker.js : $(wildcard plugins-client/ext.lang
# copies built ace modes
mode:
mkdir -p plugins-client/lib.ace/www/mode
cp `find node_modules/ace/build/src | grep -E "mode-[a-zA-Z_]+.js"` plugins-client/lib.ace/www/mode
cp `find node_modules/ace/build/src | grep -E "mode-[a-zA-Z_0-9]+.js"` plugins-client/lib.ace/www/mode

# copies built ace themes
theme:
mkdir -p plugins-client/lib.ace/www/theme
cp `find node_modules/ace/build/src | grep -E "theme-[a-zA-Z_]+.js"` plugins-client/lib.ace/www/theme
cp `find node_modules/ace/build/src | grep -E "theme-[a-zA-Z_0-9]+.js"` plugins-client/lib.ace/www/theme

min_ace:
for i in `ls ./node_modules/ace/build/src/worker*.js`; do \
node build/r.js -o name=$$i out=./plugins-client/lib.ace/www/worker/`echo $$i | sed 's/.*\///'` baseUrl=. ; \
done
# throws errors at the moment
#for i in `find node_modules/ace/build/src | grep -E "mode-[a-zA-Z_]+.js"`; do \
# node build/r.js -o name=$$i out=./plugins-client/lib.ace/www/mode/`echo $$i | sed 's/.*\///'` baseUrl=. ; \
#done
#for i in `find node_modules/ace/build/src | grep -E "theme-[a-zA-Z_]+.js"`; do \
# node build/r.js -o name=$$i out=./plugins-client/lib.ace/www/theme/`echo $$i | sed 's/.*\///'` baseUrl=. ; \
#done

gzip_safe:
for i in `ls ./plugins-client/lib.packed/www/*.js`; do \
Expand All @@ -88,7 +100,7 @@ gzip:

c9core: apf ace core worker mode theme

package: c9core ext
package: helper c9core ext min_ace

test:
$(MAKE) -C test
Expand Down
11 changes: 7 additions & 4 deletions build/app.build.js
Expand Up @@ -2,12 +2,12 @@

({
//optimize: "none",
preserveLicenseComments: false,
baseUrl: "../",
paths: {
"text" : "build/text", // plugin for pulling in text! files
"core" : "empty:",
"ext/commands" : "plugins-client/ext.commands",
"ext/uploadfiles" : "plugins-client/ext.uploadfiles",
"apf" : "empty:",
"treehugger" : "empty:",
"debug": "empty:",
Expand All @@ -30,7 +30,6 @@
'ext/searchinfiles': 'plugins-client/ext.searchinfiles',
'ext/searchreplace': 'plugins-client/ext.searchreplace',
'ext/quickwatch': 'plugins-client/ext.quickwatch',
'ext/quicksearch': 'plugins-client/ext.quicksearch',
'ext/gotoline': 'plugins-client/ext.gotoline',
'ext/preview': 'plugins-client/ext.preview',
'ext/log': 'plugins-client/ext.log',
Expand Down Expand Up @@ -67,8 +66,11 @@
'ext/closeconfirmation': 'plugins-client/ext.closeconfirmation',
'ext/codetools': 'plugins-client/ext.codetools',
'ext/colorpicker': 'plugins-client/ext.colorpicker',
'ext/gitblame': 'plugins-client/ext.gitblame',
'ext/revisions': 'plugins-client/ext.revisions',
'ext/language': 'plugins-client/ext.language'
'ext/quicksearch': 'plugins-client/ext.quicksearch',
'ext/language': 'plugins-client/ext.language',
'ext/uploadfiles': 'plugins-client/ext.uploadfiles'
},
include: ["build/src/core.packed",
"apf/elements/codeeditor",
Expand All @@ -94,7 +96,6 @@
'ext/searchinfiles/searchinfiles',
'ext/searchreplace/searchreplace',
'ext/quickwatch/quickwatch',
'ext/quicksearch/quicksearch',
'ext/gotoline/gotoline',
'ext/preview/preview',
'ext/log/log',
Expand Down Expand Up @@ -131,7 +132,9 @@
'ext/closeconfirmation/closeconfirmation',
'ext/codetools/codetools',
'ext/colorpicker/colorpicker',
'ext/gitblame/gitblame',
'ext/revisions/revisions',
'ext/quicksearch/quicksearch',
'ext/language/language'],
out: "../plugins-client/lib.packed/www/packed.js",
inlineText: true,
Expand Down
1 change: 1 addition & 0 deletions build/app.build.tmpl.js
Expand Up @@ -2,6 +2,7 @@

({
//optimize: "none",
preserveLicenseComments: false,
baseUrl: "../",
paths: {
"text" : "%b/text", // plugin for pulling in text! files
Expand Down
2 changes: 1 addition & 1 deletion build/core.build.js
Expand Up @@ -10,7 +10,7 @@
"apf-packaged": "plugins-client/lib.apf/www/apf-packaged"
},
include: [
"node_modules/ace/build/src-uncompressed/ace",
"node_modules/ace/build/src/ace",
"apf-packaged/apf_release",
"core/document",
"core/ext",
Expand Down
3 changes: 2 additions & 1 deletion build/packed_helper.js
Expand Up @@ -20,13 +20,14 @@ for (var i in extensions) {
}
}

clientMappings.push("ext/uploadfiles': 'plugins-client/ext.uploadfiles"); // TODO: why is this not automatically added?
clientPlugins = "'" + clientPlugins.join("',\n\t'") + "'";
clientMappings = "'" + clientMappings.join("',\n\t'") + "'";

var appTemplate = fs.readFileSync("./build/app.build.tmpl.js", "utf8");

// transform all variable paths out
var appFile = appTemplate.replace(/%b/g, "build").replace(/%d/, "plugins-client").replace('"%s"', clientPlugins).replace('"%m"', clientMappings).replace('"%o"', '"../plugins-client/lib.packed/www/packed.js"');
var appFile = appTemplate.replace(/%b/g, "build").replace(/%d/g, "plugins-client").replace('"%s"', clientPlugins).replace('"%m"', clientMappings).replace('"%o"', '"../plugins-client/lib.packed/www/packed.js"');

fs.writeFile("./build/app.build.js", appFile, "utf8", function(err) {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion configs/default.js
Expand Up @@ -48,7 +48,6 @@ var config = {
"./../plugins-client/lib.treehugger",
"./../plugins-client/lib.v8debug",
"./../plugins-client/lib.requirejs",
"./../plugins-client/lib.packed",

// server plugins
{
Expand Down Expand Up @@ -134,6 +133,7 @@ var config = {
//"ext/githistory/githistory",
"ext/revisions/revisions",
"ext/language/liveinspect",
"ext/quicksearch/quicksearch",
"ext/jsinfer/jsinfer"
//"ext/splitview/splitview"
//"ext/minimap/minimap"
Expand Down
22 changes: 22 additions & 0 deletions configs/packed.js
@@ -0,0 +1,22 @@
var config = require("./default");

config.containers.master.plugins.forEach(function(plugin) {
if (plugin.packagePath) {
if (/\/cloud9.core$/.test(plugin.packagePath)) {
plugin.socketIoTransports = ["websocket", "htmlfile", "xhr-multipart", "xhr-polling"];
}
}
});

config.containers.master.plugins = config.containers.master.plugins.filter(function(plugin) {
// returns false of any of these plugins are detected; lib.packed will emit them
return !(/\/plugins-client\/cloud9.core$/.test(plugin) ||
/\/plugins-client\/lib.ace$/.test(plugin) ||
/\/plugins-client\/lib.apf$/.test(plugin) ||
/\/plugins-client\/lib.treehugger$/.test(plugin) ||
/\/plugins-client\/lib.v8debug$/.test(plugin))
});

config.containers.master.plugins.push("./../plugins-client/lib.packed");

module.exports = config;
12 changes: 7 additions & 5 deletions package.json
Expand Up @@ -35,13 +35,13 @@
},

"mappings": {
"ace": ["npm", "https://github.com/ajaxorg/ace/tarball/2f006d2a5a64a8a6ef09ef0976fb412a5718711b"],
"apf": ["npm", "https://github.com/ajaxorg/apf/tarball/10179a17662c221c72bb010bd7e4feda485d2b34"],
"ace": ["npm", "https://github.com/ajaxorg/ace/tarball/da94ecdb42b46bd06991a36fdeeb6faa1d0bc882"],
"apf": ["npm", "https://github.com/ajaxorg/apf/tarball/0f7f497815b49472bb2865934ac6c71d15dcf126"],
"architect": ["npm", "https://github.com/c9/architect/tarball/6a7069e6d1b65a515af73d1dd92757da33bfc2a9"],
"asyncjs": ["npm", "https://github.com/ajaxorg/async.js/tarball/0b4ed5608a32c280a7690b5f52883d8d1fc0de08"],
"jsDAV": ["npm", "https://github.com/ajaxorg/jsDAV/tarball/21c6fea18d3480ef2641d9889e531ded60216082"],
"jsDAV": ["npm", "https://github.com/ajaxorg/jsDAV/tarball/fc9a5aba27e2ed8a7553e9b1a7c3009a943b41d9"],
"v8debug": ["npm", "https://github.com/ajaxorg/lib-v8debug/tarball/09ce2bef1c33add76ed5c52ce477df339101b435"],
"treehugger": ["npm", "https://github.com/ajaxorg/treehugger/tarball/ed2b6ebb8a812de48f0dfb12b675b91c4e4b3170"],
"treehugger": ["npm", "https://github.com/ajaxorg/treehugger/tarball/c7ee419c6c985d4369d71619b8e97044de3e502e"],
"packager": ["npm", "https://github.com/ajaxorg/packager/tarball/0b1aaac94d21a10a8ee8117495a71f788ca01372"]
},

Expand All @@ -55,6 +55,8 @@
}],

"scripts": {
"start": "sh ./bin/cloud9.sh"
"start": "sh ./bin/cloud9.sh",
"build-debug": "node ./scripts/build-debug",
"build-packed": "node ./scripts/build-packed"
}
}
9 changes: 7 additions & 2 deletions plugins-client/cloud9.core/www/core/util.js
Expand Up @@ -130,10 +130,13 @@ var SupportedIcons = {
"text/x-c": 'page_white_c',
"text/x-csharp": 'page_white_csharp',
"text/text/x-java-source": 'page_white_cup',
"text/x-markdown": 'page_white_text'
"text/x-markdown": 'page_white_text',
"text/x-xquery": 'page_white_code'
};

var contentTypes = {
"c9search": "text/x-c9search",

"js": "application/javascript",
"json": "application/json",
"css": "text/css",
Expand Down Expand Up @@ -196,7 +199,9 @@ var contentTypes = {
"sql": "text/x-sql",

"sh": "application/x-sh",
"bash": "application/x-sh"
"bash": "application/x-sh",

"xq": "text/x-xquery"
};

exports.getFileIcon = function(xmlNode) {
Expand Down
32 changes: 24 additions & 8 deletions plugins-client/ext.code/code.js
Expand Up @@ -11,12 +11,13 @@ require("apf/elements/codeeditor");

var ide = require("core/ide");
var ext = require("core/ext");
var util = require("core/util");
var menus = require("ext/menus/menus");
var commands = require("ext/commands/commands");
var EditSession = require("ace/edit_session").EditSession;
var Document = require("ace/document").Document;
var Range = require("ace/range").Range;
var MultiSelectCommands = require("ace/multi_select").commands.defaultCommands;
var MultiSelectCommands = require("ace/multi_select").commands;
var ProxyDocument = require("ext/code/proxydocument");
var defaultCommands = require("ace/commands/default_commands").commands;
var markup = require("text!ext/code/code.xml");
Expand Down Expand Up @@ -63,7 +64,8 @@ var ModesCaption = {
"SQL" : "text/x-sql",
"Textile" : "text/x-web-textile",
"HTML" : "text/html",
"XML" : "application/xml"
"XML" : "application/xml",
"XQuery" : "text/x-xquery"
}

var SupportedModes = {
Expand Down Expand Up @@ -101,10 +103,14 @@ var SupportedModes = {
"text/x-script.powershell": "powershell",
"text/x-scala": "scala",
"text/x-coldfusion": "coldfusion",
"text/x-sql": "sql"
"text/x-sql": "sql",
"text/x-c9search" : "c9search",
"text/x-xquery": "xquery"
};

var contentTypes = {
"c9search": "text/x-c9search",

"js": "application/javascript",
"json": "application/json",
"css": "text/css",
Expand Down Expand Up @@ -170,7 +176,9 @@ var contentTypes = {
"sql": "text/x-sql",

"sh": "application/x-sh",
"bash": "application/x-sh"
"bash": "application/x-sh",

"xq": "text/x-xquery"
};

module.exports = ext.register("ext/code/code", {
Expand Down Expand Up @@ -471,11 +479,11 @@ module.exports = ext.register("ext/code/code", {
// check if there is a scriptid, if not check if the file is somewhere in the stack
if (typeof mdlDbgStack != "undefined" && mdlDbgStack.data && e.node
&& (!e.node.hasAttribute("scriptid") || !e.node.getAttribute("scriptid"))
&& e.node.hasAttribute("scriptname") && e.node.getAttribute("scriptname")) {
var nodes = mdlDbgStack.data.selectNodes('//frame[@script="' + e.node.getAttribute("scriptname").replace(ide.workspaceDir + "/", "").replace(/"/g, """) + '"]');
if (nodes.length) {
&& e.node.hasAttribute("path")) {
var path = e.node.getAttribute("path").slice(ide.davPrefix.length + 1);
var nodes = mdlDbgStack.data.selectNodes('//frame[@script="' + path.replace(/"/g, """) + '"]');
if (nodes.length)
e.node.setAttribute("scriptid", nodes[0].getAttribute("scriptid"));
}
}
e.doc.editor.amlEditor.afterOpenFile(e.doc.editor.amlEditor.getSession());
}
Expand Down Expand Up @@ -789,6 +797,14 @@ module.exports = ext.register("ext/code/code", {
this.amlEditor.$editor.$nativeCommands = ceEditor.$editor.commands;
this.amlEditor.$editor.commands = commands;

// for search in files
this.amlEditor.$editor.renderer.scroller.addEventListener("dblclick", function(e) {
var node = tabEditors.getPage().$doc.getNode();

if (node.getAttribute("customtype") == util.getContentType("c9search"))
require("ext/searchinfiles/searchinfiles").launchFileFromSearch(_self.amlEditor.$editor);
});

// preload common language modes
var noop = function() {};
ceEditor.getMode("javascript", noop);
Expand Down
48 changes: 13 additions & 35 deletions plugins-client/ext.console/console.js
Expand Up @@ -51,7 +51,6 @@ module.exports = ext.register("ext/console/console", {

autoOpen : true,
excludeParent : true,
keyEvents: {},

pageIdToPidMap : {},

Expand Down Expand Up @@ -209,21 +208,6 @@ module.exports = ext.register("ext/console/console", {
});
},

commandTextHandler: function(e) {
if (this.keyEvents[e.keyCode])
this.keyEvents[e.keyCode](e.currentTarget);
},

keyupHandler: function(e) {
if (actionCodes.indexOf(e.keyCode) !== -1)
return this.commandTextHandler(e);
},

keydownHandler: function(e) {
if (actionCodes.indexOf(e.keyCode) === -1)
return this.commandTextHandler(e);
},

createOutputBlock: function(line, useOutput, tracerIdFromServer) {
var command_id_tracer = tracerIdFromServer || this.command_id_tracer;
var spinnerBtn = ['<div class="prompt_spinner"', ' id="spinner', command_id_tracer,
Expand Down Expand Up @@ -664,7 +648,7 @@ module.exports = ext.register("ext/console/console", {
_self.showInput();
txtConsoleInput.setValue(def[1]);
if (!def[4]) {
_self.keyEvents[KEY_CR](txtConsoleInput);
txtConsoleInput.execCommand("Return");
txtConsole.$container.scrollTop = txtConsole.$container.scrollHeight;
}
txtConsoleInput.focus();
Expand Down Expand Up @@ -733,9 +717,6 @@ module.exports = ext.register("ext/console/console", {
}
});

txtConsoleInput.addEventListener("keyup", this.keyupHandler.bind(this));
txtConsoleInput.addEventListener("keydown", this.keydownHandler.bind(this));

function kdHandler(e){
if (!e.ctrlKey && !e.metaKey && !e.altKey
&& !e.shiftKey && apf.isCharacter(e.keyCode))
Expand Down Expand Up @@ -780,21 +761,18 @@ module.exports = ext.register("ext/console/console", {

this.nodes.push(winDbgConsole, this.splitter);

this.keyEvents[KEY_UP] = function(input) {
var newVal = _self.cliInputHistory.getPrev() || "";
input.setValue(newVal);
};
this.keyEvents[KEY_DOWN] = function(input) {
var newVal = _self.cliInputHistory.getNext() || "";
input.setValue(newVal);
};
this.keyEvents[KEY_CR] = function(input) {
var inputVal = input.getValue().trim();
if (inputVal === "/?")
return false;
_self.evalInputCommand(inputVal);
input.setValue("");
};

txtConsoleInput.ace.commands.bindKeys({
"up": function(input) {input.setValue(_self.cliInputHistory.getPrev(), 1);},
"down": function(input) {input.setValue(_self.cliInputHistory.getNext(), 1);},
"Return": function(input) {
var inputVal = input.getValue().trim();
if (inputVal === "/?")
return false;
_self.evalInputCommand(inputVal);
input.setValue("");
},
})

if (this.logged.length) {
this.logged.forEach(function(text){
Expand Down
2 changes: 1 addition & 1 deletion plugins-client/ext.console/console.xml
Expand Up @@ -76,7 +76,7 @@
class="txt_console_prompt"
visible="false"
value="" />
<a:textbox id="txtConsoleInput"
<a:codebox id="txtConsoleInput"
initial-message = 'Type "help" to get a list of commands'
margin = "2 1 1 5"
skin = "tb_console"
Expand Down

0 comments on commit e59d76e

Please sign in to comment.