更新函数自动补全
This commit is contained in:
parent
53ae839457
commit
d3817ce868
@ -1866,13 +1866,13 @@
|
|||||||
if (!error && (data.type.startsWith('fn(') || data.doc)) {
|
if (!error && (data.type.startsWith('fn(') || data.doc)) {
|
||||||
var tip = elt("span", null, elt("strong", null, data.type || "not found"));
|
var tip = elt("span", null, elt("strong", null, data.type || "not found"));
|
||||||
if (data.doc)
|
if (data.doc)
|
||||||
tip.appendChild(document.createTextNode(" — " + data.doc)); /*
|
tip.appendChild(document.createTextNode("\n" + data.doc.replace(/<br\/?>/g,"\n")));
|
||||||
if (data.type.startsWith('fn(') && data.url) {
|
if (data.url) {
|
||||||
tip.appendChild(document.createTextNode(" "));
|
tip.appendChild(document.createTextNode("\n"));
|
||||||
var child = tip.appendChild(elt("a", null, "[docs]"));
|
var child = tip.appendChild(elt("a", null, "[文档]"));
|
||||||
child.href = data.url;
|
child.href = data.url;
|
||||||
child.target = "_blank";
|
child.target = "_blank";
|
||||||
} */
|
}
|
||||||
tempTooltip(cm, tip, ts);
|
tempTooltip(cm, tip, ts);
|
||||||
}
|
}
|
||||||
if (c) c();
|
if (c) c();
|
||||||
@ -2208,25 +2208,19 @@
|
|||||||
if (cm.state.ternTooltip) remove(cm.state.ternTooltip);
|
if (cm.state.ternTooltip) remove(cm.state.ternTooltip);
|
||||||
var where = cm.cursorCoords();
|
var where = cm.cursorCoords();
|
||||||
var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content);
|
var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content);
|
||||||
function maybeClear() {
|
|
||||||
old = true;
|
|
||||||
if (!mouseOnTip) clear();
|
|
||||||
}
|
|
||||||
function clear() {
|
function clear() {
|
||||||
|
if (mouseOnTip) {
|
||||||
|
mouseOnTip = false;
|
||||||
|
setTimeout(clear, 50);
|
||||||
|
return;
|
||||||
|
}
|
||||||
cm.state.ternTooltip = null;
|
cm.state.ternTooltip = null;
|
||||||
if (tip.parentNode) remove(tip)
|
if (tip.parentNode) remove(tip)
|
||||||
clearActivity()
|
clearActivity()
|
||||||
}
|
}
|
||||||
var mouseOnTip = false, old = false;
|
var mouseOnTip = false;
|
||||||
CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; });
|
CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; });
|
||||||
CodeMirror.on(tip, "mouseout", function(e) {
|
CodeMirror.on(tip, "mouseout", function(e) { mouseOnTip = false; });
|
||||||
var related = e.relatedTarget || e.toElement
|
|
||||||
if (!related || !CodeMirror.contains(tip, related)) {
|
|
||||||
if (old) clear();
|
|
||||||
else mouseOnTip = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
setTimeout(maybeClear, ts.options.hintDelay ? ts.options.hintDelay : 1700);
|
|
||||||
var clearActivity = onEditorActivity(cm, clear)
|
var clearActivity = onEditorActivity(cm, clear)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2244,6 +2238,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeTooltip(x, y, content) {
|
function makeTooltip(x, y, content) {
|
||||||
|
if (typeof content === 'string') {
|
||||||
|
content = content.replace(/<br\/?>/g, '\n')
|
||||||
|
}
|
||||||
var node = elt("div", cls + "tooltip", content);
|
var node = elt("div", cls + "tooltip", content);
|
||||||
node.style.left = x + "px";
|
node.style.left = x + "px";
|
||||||
node.style.top = y + "px";
|
node.style.top = y + "px";
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -31,13 +31,13 @@ editor_multi = function () {
|
|||||||
});
|
});
|
||||||
Object.keys(core.material.bgms).forEach(function (name) {
|
Object.keys(core.material.bgms).forEach(function (name) {
|
||||||
coredef.core.material.bgms[name] = {
|
coredef.core.material.bgms[name] = {
|
||||||
"!type": "?",
|
"!type": "audio",
|
||||||
"!doc": "背景音乐"
|
"!doc": "背景音乐"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Object.keys(core.material.sounds).forEach(function (name) {
|
Object.keys(core.material.sounds).forEach(function (name) {
|
||||||
coredef.core.material.sounds[name] = {
|
coredef.core.material.sounds[name] = {
|
||||||
"!type": "?",
|
"!type": "audio",
|
||||||
"!doc": "音效"
|
"!doc": "音效"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -50,7 +50,7 @@ editor_multi = function () {
|
|||||||
Object.keys(core.material.images).forEach(function (name) {
|
Object.keys(core.material.images).forEach(function (name) {
|
||||||
if (core.material.images[name] instanceof Image) {
|
if (core.material.images[name] instanceof Image) {
|
||||||
coredef.core.material.images[name] = {
|
coredef.core.material.images[name] = {
|
||||||
"!type": "?",
|
"!type": "image",
|
||||||
"!doc": "系统图片"
|
"!doc": "系统图片"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -59,7 +59,7 @@ editor_multi = function () {
|
|||||||
}
|
}
|
||||||
for (var v in core.material.images[name]) {
|
for (var v in core.material.images[name]) {
|
||||||
coredef.core.material.images[name][v] = {
|
coredef.core.material.images[name][v] = {
|
||||||
"!type": "?",
|
"!type": "image",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ editor_multi = function () {
|
|||||||
functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys.getSpecials().forEach(function (one) {
|
functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys.getSpecials().forEach(function (one) {
|
||||||
var name = one[1];
|
var name = one[1];
|
||||||
if (name instanceof Function) name = name({});
|
if (name instanceof Function) name = name({});
|
||||||
coredef.core.hasSpecial["!doc"] += name + "(" + one[0] + "); ";
|
coredef.core.enemys.hasSpecial["!doc"] += name + "(" + one[0] + "); ";
|
||||||
});
|
});
|
||||||
Object.keys(core.canvas).forEach(function (name) {
|
Object.keys(core.canvas).forEach(function (name) {
|
||||||
coredef.core.canvas[name] = {
|
coredef.core.canvas[name] = {
|
||||||
@ -104,6 +104,23 @@ editor_multi = function () {
|
|||||||
Object.keys(core.status.textAttribute).forEach(function (id) {
|
Object.keys(core.status.textAttribute).forEach(function (id) {
|
||||||
coredef.core.status.textAttribute[id] = {};
|
coredef.core.status.textAttribute[id] = {};
|
||||||
});
|
});
|
||||||
|
// --- 转发函数
|
||||||
|
for (var name in coredef.core) {
|
||||||
|
if (typeof coredef.core[name] === 'object') {
|
||||||
|
for (var funcname in coredef.core[name]) {
|
||||||
|
var one = coredef.core[name][funcname] || {};
|
||||||
|
var type = one["!type"] || "";
|
||||||
|
if (type.startsWith("fn(")) {
|
||||||
|
coredef.core[funcname] = {
|
||||||
|
"!type": one["!type"],
|
||||||
|
"!doc": one["!doc"] + "<br/>(转发到 " + name + " 中)"
|
||||||
|
};
|
||||||
|
if (one["!url"]) coredef.core[funcname]["!url"] = one["!url"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Object.keys(core.values).forEach(function (id) {
|
Object.keys(core.values).forEach(function (id) {
|
||||||
var one = data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc._data.values._data[id];
|
var one = data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc._data.values._data[id];
|
||||||
if (!one) return;
|
if (!one) return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user