-
Notifications
You must be signed in to change notification settings - Fork 39
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
In tman, the serialization and de-serialization of manifest.json/property.json should maintain their order. #122
Comments
如果要实现按序保存, 那就需要能够识别出文件中的 fields 顺序, 即需要在 deserialize 中支持这个能力.
从使用场景上来看, 可能会经过如下步骤:
这样会存在如下问题:
同样, 在 ide 中也会存在 formatter 工具, 可能会与 tman dump 时的规则不同. 一方面是不能提供完备的字段顺序的保存方案, 反而会造成数据排序混乱; 另一方面, 可能会与用户开发环境的 formatter 规则不同, 导致在使用 dev server dump 后, 用户再手动 formatter 产生文件内容变更, 造成开发上的不便. 所以, 并不适合在dump时参考已有数据的顺序. |
从本质上将, 需要做的事情应该是 dump 后, 自动 从 tman 角度, 逻辑上并不在意 fields 的顺序. 所以只需要让用户觉得是按照相同 formatter 产生的结果, 尤其是用户手动 formatter 不会产生新的变更.
|
如果 property.json / manifest.json 支持 json5, 即包含 comments, 对于 vscode 是可以支持的, 设置 目前 serde 中有对 json5 支持的实现库: https://github.com/callum-oakley/json5-rs/tree/master. 但在保存文件的场景下会存在问题, 因为 |
|
A compile switch is needed to quickly toggle between preserving the original order of code and not preserving it. In the
tman
scenario, the original order needs to be maintained, but in the runtime scenario, it's unnecessary. Preserving the original order might increase overhead in performance, disk size, or memory, so a switch may be required in the future.The text was updated successfully, but these errors were encountered: