!2224 修复:感知列表显示

pull/2177/MERGE
林伟强 1 year ago committed by ChenX
parent 19b1df4a0c
commit 0c6accae8b

@ -223,10 +223,6 @@ export class CommandServer
this._CustomCommandMap.set(customCmd, cmd);//注册自定义命令
this._CommandCustomMap.set(cmd, customCmd);
if (commandMachine.CommandNameSet.has(cmd))
{
commandMachine.CommandNameSet.delete(cmd);
}
commandMachine.CommandNameSet.add(customCmd);
}

@ -130,7 +130,7 @@ export class ConfigTagCommand
{
this._CustomTagCommandMap.set(tag.tagName, { cmdName: this._ConfigTagCommandMap.get(tag.type), configName: tag.configName, type: tag.type }); //注册自定义命令
commandMachine.CommandNameSet.add(tag.tagName);
commandMachine.CommandSet.add({command:tag.tagName, chName:tag.configName})
commandMachine.CommandSet.add({ command: tag.tagName });
}
}

@ -14,7 +14,7 @@ import { commandMachine } from '../../../Editor/CommandMachine';
import { CommandState } from '../../../Editor/CommandState';
import { CommandStore } from '../../Store/CommandStore';
import { CommandInputHeight } from '../CommandInput/CommandInputUI';
import { ICommand } from "../CommandPanel/CommandList";
import { CommandList, ICommand } from "../CommandPanel/CommandList";
import { SwitchServerStore } from '../Modal/SwitchServerStore';
import './InputHint.css';
@ -34,7 +34,7 @@ interface InputHitState
{
isShowHistory: boolean;//显示历史命令
intelliSenseIndex: number;//感知的当前选择位置
intelliSenseCommand: Array<ICommand>;//感知命令列表
intelliSenseCommand: Array<Partial<ICommand>>;//感知命令列表
topToolBarHeight: number; //顶部标签栏高度
}
@ -147,34 +147,31 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
const commandObjList = Array.from(commandMachine.CommandSet);
const verifyChNameBelongCommand = (cmdName: string, inputCmd: string) =>
{
const item = commandObjList.find((v) => v.defaultCustom === cmdName || v.command === cmdName || v.customize === cmdName);
if (item && ((item.chName && item.chName.indexOf(inputCmd) !== -1) || item.command.indexOf(inputCmd) !== -1))
intelliSenseCmdList.push(item.command || cmdName);
};
let intelliSenseCmdList: string[] = [];
for (let cmdName of commandMachine.CommandNameSet)
if (isChinese(inputCmd))//
{
try
for (let cmd of CommandList)
if (cmd.chName.indexOf(inputCmd) !== -1)
intelliSenseCmdList.push(cmd.command);
}
else
for (let cmdName of commandMachine.CommandNameSet)
{
//修改后感知列表顺序会改变
if (inputCmd.length === 1)
try
{
if (cmdName.indexOf(inputCmd) === 0)
if (inputCmd.length === 1)
{
if (cmdName.indexOf(inputCmd) === 0)
intelliSenseCmdList.push(cmdName);
}
else if (cmdName.indexOf(inputCmd) !== -1 || searchReg.test(cmdName))
intelliSenseCmdList.push(cmdName);
else verifyChNameBelongCommand(cmdName, inputCmd);
} catch (error)
{
Log("正则表达式测试错误!", LogType.Error);
}
else if (cmdName.indexOf(inputCmd) !== -1 || searchReg.test(cmdName))
intelliSenseCmdList.push(cmdName);
else verifyChNameBelongCommand(cmdName, inputCmd);
} catch (error)
{
Log("正则表达式测试错误!", LogType.Error);
}
}
intelliSenseCmdList.sort((c1, c2) =>
{
@ -195,17 +192,17 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
return c1.length < c2.length ? -1 : 1;
});
const cmdList = [];
const cmdList = new Set<Partial<ICommand>>();
for (let cmd of intelliSenseCmdList)
{
const item = commandObjList.find((v) => v.defaultCustom === cmd || v.command === cmd || v.customize === cmd);
if (item)
cmdList.push(item);
cmdList.add(item);
else
cmdList.push({ command: cmd });
cmdList.add({ command: cmd });
}
this.setState({
intelliSenseCommand: cmdList,
intelliSenseCommand: Array.from(cmdList),
intelliSenseIndex: 0
});
}

Loading…
Cancel
Save