如何修改VS Code中管道符|的斜体显示样式
解决VS Code主题斜体影响管道符显示的方案
步骤1:查询管道符对应的TextMate scope
- 打开任意包含
|的代码/文本文件,按下Ctrl+Shift+P(Mac设备按Cmd+Shift+P)调出命令面板 - 搜索并选中
Developer: Inspect Editor Tokens and Scopes进入符号检查模式 - 点击页面上的斜体管道符,弹出的信息面板中
textmate scopes栏就是该符号对应的作用域列表,优先选择列表最顶部的精准作用域
步骤2:添加自定义样式配置
在命令面板搜索Preferences: Open Settings (JSON)打开用户配置文件,添加如下规则:
"editor.tokenColorCustomizations": { "textMateRules": [ { "name": "Fix italic pipe characters", "scope": [ // 下方为常见场景的管道符scope,可替换为你自己查询到的scope "punctuation.separator.pipe", "punctuation.separator.table.markdown", "punctuation.separator.pipe.shell", "punctuation.separator.union.ts", "punctuation.separator.union.js" ], "settings": { // 强制取消斜体样式 "fontStyle": "normal" } } ] }
保存配置后即可生效,所有匹配scope的管道符都会保持垂直的正常显示,不会受主题斜体规则影响。
内容的提问来源于stack exchange,提问作者dodo
相关产品推荐
相关产品推荐

