-
-
Notifications
You must be signed in to change notification settings - Fork 80
feat: improve callSteam support #534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve callSteam support #534
Conversation
Summary of ChangesHello @HardyNLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求全面增强了对 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 旨在完善 callSteam 命令的支持,整体实现得不错。主要改动包括在文本编辑器中增加了对 callSteam 的高亮和自动补全,并在图形编辑器中进行了重构,使其不再特殊处理 callSteam 命令。
我在代码中发现了一些可以改进的地方:
- 在
hl.json文件中,命令列表存在多处重复,这会影响未来的可维护性。 - 在
CallSteam.tsx组件中,submit函数的逻辑存在一个 bug,当用户更改参数键时,可能会导致生成不正确的脚本。
具体的修改建议请见我的评论。修复这些问题后,代码会更加健壮和易于维护。
| const submitString = combineSubmitString( | ||
| props.sentence.commandRaw || CALL_STEAM_COMMAND, | ||
| props.sentence.commandRaw, | ||
| "", | ||
| props.sentence.args.filter((arg) => arg.key !== "speaker"), | ||
| normalizedKey ? [{ key: normalizedKey, value: paramValue.value, fullMode: true }] : [], | ||
| props.sentence.args, | ||
| [ | ||
| ...(normalizedKey ? [ | ||
| { key: normalizedKey, value: paramValue.value, fullMode: true } | ||
| ] : []), | ||
| ], | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submit 函数的逻辑存在缺陷。当用户在UI中更改参数的键时,旧的参数不会从句子中移除。combineSubmitString 会保留新旧两个参数,导致生成错误的脚本。
为了修复这个问题,在调用 combineSubmitString 之前,应该从 originalArgs 中过滤掉所有此组件能管理的参数,然后只在 newArgs 中添加当前选中的参数。
const submitString = combineSubmitString(
props.sentence.commandRaw,
"",
props.sentence.args.filter(arg => !paramOptions.has(arg.key)),
normalizedKey ? [{ key: normalizedKey, value: paramValue.value, fullMode: true }] : [],
);
| "character-colon": { | ||
| "comment": "[char]:[utt[ -args]][;cmt]", | ||
| "match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)", | ||
| "match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait|callSteam)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
介绍
完善 callSteam 命令支持。
Note
建议先更新 webgal-parser
主要更改
callSteam高亮callSteam补全achievementId参数补全