优化自动补全

This commit is contained in:
ckcz123 2020-05-14 10:41:16 +08:00
parent 732a202c04
commit 41a94b9685

View File

@ -884,6 +884,8 @@ function omitedcheckUpdateFunction(event) {
editor_blockly.getAutoCompletions = function (content, type, name) {
// --- content为当前框中输入内容将返回一个列表为后续所有可补全内容
// console.log(type, name);
// 检查 status:xxxitem:xxx和flag:xxx
var index = Math.max(content.lastIndexOf(":"), content.lastIndexOf(""));
if (index >= 0) {
@ -986,10 +988,9 @@ function omitedcheckUpdateFunction(event) {
var allBgms = Object.keys(core.material.bgms);
var allSounds = Object.keys(core.material.sounds);
var allShops = Object.keys(core.status.shops);
var allColors = ["aqua湖绿色", "black黑色", "blue蓝色", "fuchsia红紫色", "gray灰色", "green绿色", "lime石灰色",
"maroon紫褐色", "navy深蓝色", "gold金色",
"olive黄褐色", "orange橙色", "purple紫色", "red红色", "silver银色", "teal蓝绿色", "white白色", "yellow黄色"];
var allColors = ["aqua青色", "black黑色", "blue蓝色", "fuchsia品红色", "gray灰色", "green深绿色", "lime绿色",
"maroon深红色", "navy深蓝色", "gold金色", "olive黄褐色", "orange橙色", "purple品红色",
"red红色", "silver淡灰色", "teal深青色", "white白色", "yellow黄色"];
var filter = function (list, content) {
return list.filter(function (one) {
return one != content && one.startsWith(content);
@ -1001,7 +1002,7 @@ function omitedcheckUpdateFunction(event) {
|| (type == 'choices_s' && name == 'IdString_0') || (type == 'choicesContext' && name == 'IdString_0')
|| (type == 'closeDoor_s' && name == 'IdString_0') || (type == 'setBlock_s' && name == 'EvalString_0')
|| (type == 'setBgFgBlock_s' && name == 'EvalString_0') || (type == 'drawIcon_s' && name == 'IdString_0')
) {
|| (type == 'shopsub' && name == 'IdString_1') || (type == 'shopChoices' && name == 'IdString_0')) {
return filter(allIds, content);
}