Merge branch 'master' of https://github.com/Microsoft/TouchDevelop
This commit is contained in:
Коммит
8ba8a612cd
10
ast/diff.ts
10
ast/diff.ts
|
@ -238,7 +238,12 @@ module TDev.AST.Diff {
|
|||
{
|
||||
var d = new DiffFeatureDetector(opt)
|
||||
d.dispatch(n)
|
||||
return d.features
|
||||
var f = d.features
|
||||
Object.keys(f).forEach(k => {
|
||||
if (/^numberLiteral:/.test(k) || /^op:[0-9]/.test(k))
|
||||
f[k] = f[k] * 0.2
|
||||
})
|
||||
return f
|
||||
}
|
||||
|
||||
static cmp(a:any, b:any)
|
||||
|
@ -863,7 +868,8 @@ module TDev.AST.Diff {
|
|||
return 1;
|
||||
if (!a) {
|
||||
if (/^[0-9\.]$/.test(b.getText()))
|
||||
return 1 - (0.1 / (eh1.tokens.indexOf(b) + 2))
|
||||
// used to be "1 -"; not sure what for --MM
|
||||
return 1 + (0.1 / (eh1.tokens.indexOf(b) + 2))
|
||||
else
|
||||
return 1 + (0.1 / (eh1.tokens.indexOf(b) + 2))
|
||||
}
|
||||
|
|
|
@ -2163,7 +2163,7 @@ export function globalInit()
|
|||
} else if (process.argv[2] == "mergetest") {
|
||||
mergetest(process.argv.slice(3))
|
||||
} else {
|
||||
var text = fs.readFileSync(process.argv[2], "utf8").replace(/^\uFEFF/, "");
|
||||
var text = fs.readFileSync(process.argv[2], "utf8");
|
||||
runScriptAsync(text).done((v) => {
|
||||
console.log(v)
|
||||
})
|
||||
|
|
|
@ -760,7 +760,7 @@ module TDev.HTML {
|
|||
{
|
||||
var ta = HTML.mkTextArea();
|
||||
var pre = document.createElement("pre");
|
||||
var dismiss = showDismiss ? div('close-round-button', HTML.mkImg("svg:cancel,black")).withClick(() => {
|
||||
var dismiss = showDismiss ? div('close-round-button', HTML.mkImg("svg:check,black")).withClick(() => {
|
||||
if(r.onDismiss) r.onDismiss();
|
||||
}) : null
|
||||
var content = span(null, null)
|
||||
|
|
|
@ -25,7 +25,7 @@ function main() {
|
|||
|
||||
|
||||
var ff = fs.readFileSync("build/shell.js", "utf8")
|
||||
ff = ff.replace(/^\uFEFF/, "#!/usr/bin/env node\n")
|
||||
ff = ff.replace(/^/g, "#!/usr/bin/env node\n")
|
||||
ff = ff.replace(/\r/g, "")
|
||||
ff = ff.replace(/^\s*var isNpm =.*$/m, "var isNpm = true;")
|
||||
var npm = "shell/npm/"
|
||||
|
|
|
@ -1735,18 +1735,28 @@ function respawnLoop()
|
|||
|
||||
// process.env["TD_AUTO_UPDATE_ENABLED"] = "true"
|
||||
|
||||
var attempts = 0;
|
||||
|
||||
function startOne() {
|
||||
var startTime = Date.now()
|
||||
var child = child_process.fork(process.cwd() + "/tdserver.js", process.argv.slice(2))
|
||||
child.on("exit", (code) => {
|
||||
debug.log("local folder touchdevelop exit, " + code)
|
||||
if (code === 0)
|
||||
startOne()
|
||||
if (code === 0) {
|
||||
if (++attempts > 10) {
|
||||
console.error("Too many failures, aborting. Please retry manually.");
|
||||
process.exit();
|
||||
} else {
|
||||
console.log("Failure, retrying in 5s...");
|
||||
setTimeout(startOne, 5000);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!fs.existsSync("tdserver.js")) copy()
|
||||
startOne()
|
||||
if (!fs.existsSync("tdserver.js"))
|
||||
copy();
|
||||
startOne();
|
||||
}
|
||||
|
||||
var _shellSha = ""
|
||||
|
|
|
@ -12,7 +12,7 @@ var path = require('path');
|
|||
|
||||
function readFile(filename:string)
|
||||
{
|
||||
return fs.readFileSync(filename, "utf8").replace(/^\uFEFF/, "");
|
||||
return fs.readFileSync(filename, "utf8");
|
||||
}
|
||||
|
||||
function writeFile(filename:string, text:string) {
|
||||
|
|
|
@ -2444,7 +2444,7 @@ function dlstats(args:string[])
|
|||
|
||||
function printscript(args:string[])
|
||||
{
|
||||
args.forEach(a => console.log("\uFEFF" + getScript(a)))
|
||||
args.forEach(a => console.log(getScript(a)))
|
||||
}
|
||||
|
||||
function byruns(args:string[])
|
||||
|
|
|
@ -49,7 +49,7 @@ interface IScript
|
|||
|
||||
function loadText(filename:string)
|
||||
{
|
||||
return fs.readFileSync(filename, "utf8").replace(/^\uFEFF/, "");
|
||||
return fs.readFileSync(filename, "utf8");
|
||||
}
|
||||
|
||||
function loadJson(filename:string)
|
||||
|
@ -58,7 +58,6 @@ function loadJson(filename:string)
|
|||
}
|
||||
|
||||
function saveText(filename:string, text:string) {
|
||||
if (text.charAt(0) != '\uFEFF') text = '\uFEFF' + text;
|
||||
var s = fs.existsSync(filename) ? fs.statSync(filename) : null;
|
||||
if (s && (s.mode & 0x80) == 0) {
|
||||
console.log("running tf edit " + filename);
|
||||
|
|
Загрузка…
Ссылка в новой задаче