Merge remote-tracking branch 'origin/master' into revert-attempt

Conflicts:
	package.json
	plugins/c9.ide.performancestats/stats.js
	plugins/c9.worker/backup.js
pull/39/head^2
Lennart Kats 2015-03-03 10:25:46 +01:00
commit 4a0a75adf8
10 zmienionych plików z 76 dodań i 38 usunięć

Wyświetl plik

@ -46,19 +46,20 @@ exports.$detectIndentation = function(lines, fallback) {
if (!/^\s*[^*+\-\s]/.test(line)) if (!/^\s*[^*+\-\s]/.test(line))
continue; continue;
if (line[0] == "\t") if (line[0] == "\t") {
tabIndents++; tabIndents++;
prevSpaces = -Number.MAX_VALUE;
var spaces = line.match(/^ */)[0].length; } else {
if (spaces && line[spaces] != "\t") { var spaces = line.match(/^ */)[0].length;
var diff = spaces - prevSpaces; if (spaces && line[spaces] != "\t") {
if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff)) var diff = spaces - prevSpaces;
changes[diff] = (changes[diff] || 0) + 1; if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
changes[diff] = (changes[diff] || 0) + 1;
stats[spaces] = (stats[spaces] || 0) + 1;
stats[spaces] = (stats[spaces] || 0) + 1;
}
prevSpaces = spaces;
} }
prevSpaces = spaces;
// ignore lines ending with backslash // ignore lines ending with backslash
while (i < max && line[line.length - 1] == "\\") while (i < max && line[line.length - 1] == "\\")
line = lines[i++]; line = lines[i++];
@ -81,7 +82,7 @@ exports.$detectIndentation = function(lines, fallback) {
spaceIndents = score; spaceIndents = score;
score = stats[1] ? 0.9 : 0.8; score = stats[1] ? 0.9 : 0.8;
if (!stats.length) if (!stats.length)
score = 0 score = 0;
} else } else
score /= spaceIndents; score /= spaceIndents;
@ -95,9 +96,11 @@ exports.$detectIndentation = function(lines, fallback) {
if (first.score && first.score > 1.4) if (first.score && first.score > 1.4)
var tabLength = first.length; var tabLength = first.length;
if (tabIndents > spaceIndents + 1) if (tabIndents > spaceIndents + 1) {
if (tabLength == 1 || spaceIndents < tabIndents / 4 || first.score < 1.8)
tabLength = undefined;
return {ch: "\t", length: tabLength}; return {ch: "\t", length: tabLength};
}
if (spaceIndents > tabIndents + 1) if (spaceIndents > tabIndents + 1)
return {ch: " ", length: tabLength}; return {ch: " ", length: tabLength};
}; };

Wyświetl plik

@ -29,7 +29,13 @@ module.exports = {
assert.equal(indent.ch, "\t"); assert.equal(indent.ch, "\t");
assert.equal(indent.length, undefined); assert.equal(indent.length, undefined);
s.insert({row: 0, column: 0}, " "); s.insert({row: 0, column: 0}, " ");
indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, "\t");
assert.equal(indent.length, undefined);
s.doc.removeInLine(0, 0, 1);
s.insert({row: 0, column: 0}, "x\n y\n");
indent = whitespace.$detectIndentation(s.doc.$lines); indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, "\t"); assert.equal(indent.ch, "\t");
assert.equal(indent.length, 4); assert.equal(indent.length, 4);

Wyświetl plik

@ -3,10 +3,13 @@
"use server"; "use server";
"use mocha"; "use mocha";
require("c9/inline-mocha")(module);
var expect = require('chai').expect; var expect = require('chai').expect;
describe('vfs-local', function () { describe('vfs-local', function () {
this.timeout(5000);
var root = __dirname + "/mock2/"; var root = __dirname + "/mock2/";
var base = root.substr(0, root.length - 1); var base = root.substr(0, root.length - 1);

2
node_modules/vfs-socket/worker.js wygenerowano vendored
Wyświetl plik

@ -168,7 +168,7 @@ function Worker(vfs) {
streams[id] = stream; streams[id] = stream;
stream.id = id; stream.id = id;
stream.on("error", function(err) { stream.on("error", function(err) {
remote.onError(id, err); remote.onError && remote.onError(id, err);
}); });
if (stream.readable) { if (stream.readable) {
stream.on("data", function (chunk) { stream.on("data", function (chunk) {

Wyświetl plik

@ -12,7 +12,7 @@
"dependencies": { "dependencies": {
"acorn": ">=0.11.0", "acorn": ">=0.11.0",
"amd-loader": "~0.0.5", "amd-loader": "~0.0.5",
"async": "~0.2.7", "async": "^0.9.0",
"base64id": "~0.1.0", "base64id": "~0.1.0",
"c9": "0.1.0", "c9": "0.1.0",
"connect": "~2.12.0", "connect": "~2.12.0",
@ -64,8 +64,8 @@
"c9.ide.local": "#2bfd7ff051", "c9.ide.local": "#2bfd7ff051",
"c9.ide.find": "#989c06e6a7", "c9.ide.find": "#989c06e6a7",
"c9.ide.find.infiles": "#28b3cfcb47", "c9.ide.find.infiles": "#28b3cfcb47",
"c9.ide.find.replace": "#43a6b95e6a", "c9.ide.find.replace": "#e4daf722b8",
"c9.ide.run.debug": "#789019f9a7", "c9.ide.run.debug": "#36245ee2aa",
"c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.emmet": "#e5f1a92ac3",
"c9.ide.ace.gotoline": "#4d1a93172c", "c9.ide.ace.gotoline": "#4d1a93172c",
"c9.ide.ace.keymaps": "#2477fd8ac6", "c9.ide.ace.keymaps": "#2477fd8ac6",

Wyświetl plik

@ -632,6 +632,11 @@ define(function(require, exports, module) {
max: "64", max: "64",
position: 100 position: 100
}, },
"Autodetect Tab Size on Load" : {
type: "checkbox",
path: "project/ace/@guessTabSize",
position: 150
},
"New File Line Endings" : { "New File Line Endings" : {
type: "dropdown", type: "dropdown",
path: "project/ace/@newLineMode", path: "project/ace/@newLineMode",
@ -1977,6 +1982,7 @@ define(function(require, exports, module) {
} }
function hideProgress(){ function hideProgress(){
if (!ace) return; // ace was destroyed during timeout
var style = progress.background.style; var style = progress.background.style;
function hide() { function hide() {
style.display = "none"; style.display = "none";
@ -1993,7 +1999,6 @@ define(function(require, exports, module) {
style.opacity = 0; style.opacity = 0;
ace.renderer.unfreeze(); ace.renderer.unfreeze();
// ace.resize(true);
} }
function showProgress(value, upload, t) { function showProgress(value, upload, t) {
@ -2052,7 +2057,8 @@ define(function(require, exports, module) {
function detectSettingsOnLoad(c9Session) { function detectSettingsOnLoad(c9Session) {
var session = c9Session.session; var session = c9Session.session;
whitespaceUtil.detectIndentation(session); if (settings.get("project/ace/@guessTabSize"))
whitespaceUtil.detectIndentation(session);
if (!session.syntax) { if (!session.syntax) {
var syntax = detectSyntax(c9Session); var syntax = detectSyntax(c9Session);
if (syntax) if (syntax)

Wyświetl plik

@ -39,13 +39,16 @@ define(function(require, module, exports) {
// Listen to changes and detect when the value of the editor // Listen to changes and detect when the value of the editor
// is different from what is on disk // is different from what is on disk
undoManager.on("change", function(e) { function initUndo(){
var c = !undoManager.isAtBookmark(); undoManager.on("change", function(e) {
if (changed !== c || undoManager.position == -1) { var c = !undoManager.isAtBookmark();
changed = c; if (changed !== c || undoManager.position == -1) {
emit("changed", { changed: c }); changed = c;
} emit("changed", { changed: c });
}); }
});
}
initUndo();
/***** Methods *****/ /***** Methods *****/
@ -401,6 +404,11 @@ define(function(require, module, exports) {
* @property {UndoManager} undoManager * @property {UndoManager} undoManager
*/ */
get undoManager(){ return undoManager; }, get undoManager(){ return undoManager; },
set undoManager(newUndo){
undoManager.unload();
undoManager = newUndo;
initUndo();
},
_events: [ _events: [
/** /**

Wyświetl plik

@ -1,10 +1,16 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Test Runner</title> <title>Test Runner</title>
<link rel="stylesheet" href="lib/mocha/mocha.css" /> <link rel="stylesheet" href="lib/mocha/mocha.css" />
<style> HTML { overflow: auto !important } </style> <style>
HTML { overflow: auto !important }
body {
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 60px 50px;
}
</style>
</head> </head>
<body> <body>
<div id="mocha"></div> <div id="mocha"></div>
@ -88,11 +94,17 @@
}; };
Storage.create(window, "localStorage"); Storage.create(window, "localStorage");
Storage.create(window, "sessionStorage"); Storage.create(window, "sessionStorage");
/*global Mocha, mocha*/ /*global Mocha, mocha*/
mocha.reporter(function(runner) { mocha.reporter(function(runner) {
Mocha.reporters.Base.call(this, runner); function extend(target, BaseFn, arg) {
Mocha.reporters.HTML.call(this, runner); var base = BaseFn.prototype;
for (var i in base) if (!target[i]) target[i] = base[i];
BaseFn.call(target, arg);
}
extend(this, Mocha.reporters.Base, runner);
extend(this, Mocha.reporters.HTML, runner);
var tests = []; var tests = [];
var stats = this.stats; var stats = this.stats;

Wyświetl plik

@ -364,7 +364,8 @@ require([
})(), })(),
util: { util: {
alert: function() {}, alert: function() {},
escapeXml: function(s) { return s; } escapeXml: function(s) { return s; },
stableStringify: function(s) { return JSON.stringify(s); },
}, },
gotoline: { gotoline: {
toggle: function(){ } toggle: function(){ }

Wyświetl plik

@ -110,4 +110,3 @@ updateNodeModules
echo "Success!" echo "Success!"
echo "run '${yellow}node server.js -p 8181 -l 0.0.0.0 -a :${resetColor}' to launch Cloud9" echo "run '${yellow}node server.js -p 8181 -l 0.0.0.0 -a :${resetColor}' to launch Cloud9"
"$NODE" server.js -p 8181 -l 0.0.0.0 -a :