Merge pull request #1391 from ajaxorg/cleanup

Cleanup
This commit is contained in:
Lennart Kats 2013-04-24 03:49:41 -07:00
commit 985566b38d
6 changed files with 87 additions and 28 deletions

View file

@ -20,8 +20,7 @@ var theme = require("../../lib/ace/theme/twilight");
var port = process.env.PORT || 2222;
http.createServer(function(req, res) {
res.writeHead(200, {"Content-Type": "text/html"});
res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"});
fs.readFile(__filename, "utf8", function(err, data) {
var highlighted = highlighter.render(data, new JavaScriptMode(), theme);
res.end('<html><body>\n\

View file

@ -967,6 +967,11 @@ oop.inherits(FoldMode, BaseFoldMode);
<div class="text-logo" style="margin-left:-17px;font-family:'Henny Penny',cursive;">ChocolateJs</div>
<a href="https://chocolatejs.org">Chocolatejs</a>
</li>
<li>
<img src="http://multiplay.io/images/logo.png"
style="position: relative; left: 4px; width: 96px;top: -17px;">
<a href="http://multiPlay.io/">MultiPlay.io</a>
</li>
<li>
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
</li>

View file

@ -344,8 +344,8 @@ var Editor = function(renderer, session) {
* Gets the current font size of the editor text.
*/
this.getFontSize = function () {
return this.setOption("fontSize") ||
dom.computedStyle(ace.container, "fontSize")
return this.getOption("fontSize") ||
dom.computedStyle(this.container, "fontSize");
};
/**

View file

@ -45,35 +45,39 @@ function assertLocation(e, sl, sc, el, ec) {
assert.equal(e.location.last_column, ec);
}
function parse(str) {
try {
coffee.parse(str).compile();
} catch (e) {
return e;
}
}
module.exports = {
"test parse valid coffee script": function() {
coffee.parse("square = (x) -> x * x");
},
"test parse invalid coffee script": function() {
try {
coffee.parse("a = 12 f");
} catch (e) {
assert.equal(e.message, "Unexpected 'IDENTIFIER'");
assertLocation(e, 0, 4, 0, 5);
}
var e = parse("a = 12 f");
assert.equal(e.message, "Unexpected 'IDENTIFIER'");
assertLocation(e, 0, 4, 0, 5);
},
"test parse missing bracket": function() {
try {
coffee.parse("a = 12 f {\n\n");
} catch (e) {
assert.equal(e.message, "missing }");
assertLocation(e, 0, 10, 0, 10);
}
var e = parse("a = 12 f {\n\n");
assert.equal(e.message, "missing }");
assertLocation(e, 0, 10, 0, 10);
},
"test unexpected indent": function() {
try {
coffee.parse("a\n a\n");
} catch (e) {
assert.equal(e.message, "Unexpected 'INDENT'");
assertLocation(e, 0, 0, 0, 0);
}
var e = parse("a\n a\n");
assert.equal(e.message, "Unexpected 'INDENT'");
assertLocation(e, 0, 0, 0, 0);
},
"test invalid destructuring": function() {
var e = parse("\n{b: 5} = {}");
assert.equal(e.message, '"5" cannot be assigned');
assertLocation(e, 1, 4, 1, 4);
}
};

View file

@ -40,7 +40,7 @@ window.addEventListener = function() {};
var Worker = exports.Worker = function(sender) {
Mirror.call(this, sender);
this.setTimeout(200);
this.setTimeout(250);
};
oop.inherits(Worker, Mirror);
@ -51,7 +51,7 @@ oop.inherits(Worker, Mirror);
var value = this.doc.getValue();
try {
coffee.parse(value);
coffee.parse(value).compile();
} catch(e) {
var loc = e.location;
if (loc) {

View file

@ -10,9 +10,13 @@
<link href="../doc/site/images/favicon.ico" rel="icon" type="image/x-icon">
</head>
<body>
<div id="optionsPanel" style="position:absolute;height:100%;width:260px">
<a href="http://ajaxorg.github.com/ace/" >
<img id="logo" src="demo/kitchen-sink/logo.png">
</a>
<div style="position: absolute; overflow: hidden; top:80px; bottom:0">
<div style="width: 120%; height:100%; overflow-y: scroll">
<table id="controls">
<tr>
<td colspan="2">
@ -78,8 +82,11 @@
<option value="ace/theme/solarized_light">Solarized Light</option>
<option value="ace/theme/textmate" selected="selected">TextMate</option>
<option value="ace/theme/tomorrow">Tomorrow</option>
<option value="ace/theme/xcode">XCode</option>
</optgroup>
<optgroup label="Dark">
<option value="ace/theme/ambiance">Ambiance</option>
<option value="ace/theme/chaos">Chaos</option>
<option value="ace/theme/clouds_midnight">Clouds Midnight</option>
<option value="ace/theme/cobalt">Cobalt</option>
<option value="ace/theme/idle_fingers">idleFingers</option>
@ -95,7 +102,7 @@
<option value="ace/theme/tomorrow_night_blue">Tomorrow Night Blue</option>
<option value="ace/theme/tomorrow_night_bright">Tomorrow Night Bright</option>
<option value="ace/theme/tomorrow_night_eighties">Tomorrow Night 80s</option>
<option value="ace/theme/twilight">Twilight</option>
<option value="ace/theme/twilight">Twilight</option>
<option value="ace/theme/vibrant_ink">Vibrant Ink</option>
</optgroup>
</select>
@ -109,8 +116,10 @@
<option value="10px">10px</option>
<option value="11px">11px</option>
<option value="12px" selected="selected">12px</option>
<option value="13px">13px</option>
<option value="14px">14px</option>
<option value="16px">16px</option>
<option value="18px">18px</option>
<option value="20px">20px</option>
<option value="24px">24px</option>
</select>
@ -238,14 +247,54 @@
<label for="fade_fold_widgets">Fade Fold Widgets</label>
</td>
<td>
<input type="checkbox" id="fade_fold_widgets" checked>
<input type="checkbox" id="fade_fold_widgets">
</td>
</tr>
<tr>
<td >
<label for="elastic_tabstops">Enable Elastic Tabstops</label>
</td>
<td>
<input type="checkbox" id="elastic_tabstops">
</td>
</tr>
<tr>
<td >
<label for="isearch">Incremental Search</label>
</td>
<td>
<input type="checkbox" id="isearch">
</td>
</tr>
<tr>
<td >
<label for="highlight_token">Show token info</label>
</td>
<td>
<input type="checkbox" id="highlight_token">
</td>
</tr>
<tr>
<td >
<label for="read_only">Read-only</label>
</td>
<td>
<input type="checkbox" id="read_only">
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="Edit Snippets", onclick="env.editSnippets()">
</td>
</tr>
</table>
</td></tr>
</table>
</div>
</div>
</div>
<div id="editor"></div>
<div id="editor-container"></div>
<!--DEVEL-->
<script type="text/javascript">
@ -284,7 +333,9 @@
}
function end(){
shouldProfile && console.profileEnd()
console.log(startTime - Date.now())
var dt = startTime - Date.now()
console.log(dt)
ace.cmdLine.setValue(dt+"", 1)
}
/*editor.renderer.scrollToY(0);