|
|
|
@ -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
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|