【问题标题】:How to make my vscode font slant like sublime?如何让我的 vscode 字体像 sublime 一样倾斜?
【发布时间】:2021-04-29 02:00:31
【问题描述】:

我在 VScode 和 sublime 中使用 相同的字体(Consolas)。但是在同一个地方看起来不一样:

这是我的 sublime 设置:

{
    "auto_complete_selector": "source,text",
    "color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
    "font_face": "Consolas",
    "font_size": 12,
    "ignored_packages":
    [
    ],
    "theme": "Default.sublime-theme"
}

这是我的 vscode 设置:

    "materialTheme.accent": "Blue",
    "editor.fontFamily": "Consolas, 'Courier New', monospace",
    "editor.fontWeight": 520,
    "editor.codeLensFontSize": 11,
    "editor.fontSize": 15,
    "editor.formatOnType": true,
    "debug.console.fontFamily": "Cascadia Mono",
    "python.showStartPage": false,
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ],
    "explorer.confirmDelete": false,
    "todo-tree.tree.showScanModeButton": true,
    "editor.fontLigatures": true,
    "editor.tokenColorCustomizations": {
       "comments": "#7ea9eb"
    

我的问题是:如何让我的 vscode 字体像 sublime 一样倾斜?

【问题讨论】:

  • 使用 Winter Is Coming 等不同的主题,或使用 TextMate 范围自定义您当前的主题
  • 感谢提示,这正是我想要的!@rioV8
  • 你能提供你的配色方案的名称吗?谢谢!
  • vscode 主题是Material ~@AnsonH

标签: visual-studio-code sublimetext3 vscode-settings


【解决方案1】:

根据VS Code documentation,您可以在用户设置中使用editor.tokenColorCustomizations 规则自定义主题颜色:

  1. 打开您的settings.json 并首先添加以下规则(将YOUR THEME NAME HERE 替换为您的颜色主题名称):

    "editor.tokenColorCustomizations": {
       "[YOUR THEME NAME HERE]": {
          "textMateRules": []
       }
    }
    
  2. 打开您选择的 Python 文件。然后,使用 Ctrl+Shift+P 打开命令面板并运行“Developer: Inspect Editor Tokens and Scopes”

  3. 单击您希望将其设为斜体的关键字。例如,我们点击class 关键字来查看它的TextMate 范围。复制突出显示的第一个 TextMate 范围 ID:

  4. 返回您的settings.json。在 textMateRules 数组中,插入一个新对象,其中 scope 属性是您刚刚复制的 TextMate 范围 ID。

    "editor.tokenColorCustomizations": {
       "[YOUR THEME NAME HERE]": {
          "textMateRules": [
            {
              "scope": "storage.type.class.python",
              "settings": {
                "fontStyle": "italic"
              }
            }
          ]
       }
    }
    
  5. 保存您的settings.json,您应该会看到class 键盘以斜体显示

注意

您可以在textMateRules 数组中附加更多对象,以使更多关键字的字体斜体。例如:

"editor.tokenColorCustomizations": {
  "[YOUR THEME NAME HERE]": {
    "textMateRules": [
      {
        "scope": "variable.parameter.function.language.special.self.python",
        "settings": {
          "fontStyle": "italic"
        }
      },
      {
        "scope": "storage.type.class.python",
        "settings": {
          "fontStyle": "italic"
        }
      }
    ]
  }
},

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-12
    • 2014-03-30
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    相关资源
    最近更新 更多