✨ 未定义元数据标签在编辑器中显示警告#1608
Conversation
@tag 若不在已知元数据提示列表中,现在会在编辑器中以警告标记显示(沿用悬浮提示的 undefinedPrompt 文案),提示用户该标签暂未被 ScriptCat 支持。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
复核了当前 head
修复以上误报、扫描范围和 marker 生命周期后,再跑 typecheck、lint 与定向测试即可。FOSSA |
- 本地化标签(name:<locale>/description:<locale>)不再被误报为未定义标签 - 区块扫描改为与运行时 parseMetadata 一致:仅识别首个成对闭合的 UserScript 区块 - 编辑注释行首字符后不再遗留过期 marker - 将纯逻辑抽取到 metadata.ts 并补充单元测试 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for the detailed review @CodFrm — confirmed all four points against
已过 |
|
checked by me. |


Checklist / 检查清单
@tagmetadata lines only surfaced as a hover tooltip; they now also show as an editor warning marker背景
编辑器悬浮提示已能识别不在 ScriptCat 元数据提示表中的
@tag(显示 "Undefined Prompt"),但这些标签在编辑器中没有任何可见的警告标记,用户只有主动悬浮才能发现该标签暂不受支持。本次改动
getUndefinedMetadataTagMarkers(src/pkg/utils/monaco-editor/index.ts),扫描==UserScript==元数据块内的每一行,复用悬浮提示已用的metadataHoverPattern提取标签promptByMetadataTag中,则在编辑器中生成一个MarkerSeverity.Warning标记(rule idscriptcat/undefined-metadata-tag),消息复用既有的currentEditorLang.undefinedPrompt文案(已支持所有语言),提示用户暂不受支持已知限制
undefinedPrompt文案,未新增专门的“不支持”措辞建议审查重点
name、grant、run-at等)不应被误标记为警告@noframes)也应被正确识别,不受metadataAlignmentPattern需要尾随空格+值的限制验证
pnpm run typecheck— 通过pnpm exec eslint src/pkg/utils/monaco-editor/index.ts— 无报错