Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
任务简述
优化 JSON 代码块的语法高亮渲染效果,修复夜间模式下字符串及数字颜色暗淡难以辨认的问题,实现键与值的差异化色彩区分,并为日间与夜间模式提供自适应语法高亮(详见 dev-agent-6106 任务文档
devel/6106.stem)。问题分析
json-lang.scm缺少define-preferences,所有颜色均回退至默认编码:"dark grey";"#3030b0"(深藏青蓝);dark主题)的深灰底色下,"dark grey"与"#3030b0"对比度极低,几乎无法分辨。json.stem中将代码块字体指定为了"font-family" "rm"(罗马衬线体),与其它代码块统一使用的等宽字体"tt"不一致。解决方案
prog_language_rep::get_color中,当语言为"json"且遇到字符串解析器匹配时,向前探测跳过空格后的字符是否为冒号:。若紧跟冒号则判定为对象键(variable_identifier),否则判定为普通字符串值(constant_string)。env_default.cpp与json.stem提供日间默认配色:键为紫色(#8020c0)、字符串值为森林绿(#2e7d32)、数字为宝蓝(#0066cc)、布尔与null为珊瑚红(#c63d2f)、分隔符与括号为石板灰(#555555);dark.ts与dark-scene.ts提供夜间(深色主题)自适应高亮:键为柔和浅紫(#c678dd)、字符串值为柔和浅绿(#98c379)、数字为明朗天蓝(#61afef)、布尔与null为浅珊瑚粉(#e06c75)、标点与括号为浅灰(#abb2bf)与暖金(#e5c07b);json-lang.scm引入define-preferences并将syntax:json:...映射到环境自适应变量;\uXXXX及单行/多行注释语法特性支持。json.stem中将字体修正为"font-family" "tt"。TeXmacs/progs/prog/tests/json-lang-test.scm(48 项断言全部通过);TeXmacs/tests/6106.scm及测试样例文档TeXmacs/tests/tmu/6106.tmu、TeXmacs/tests/tmu/6106_dark.tmu。