【问题标题】:Disable italic syntax highlighting in VS Code在 VS Code 中禁用斜体语法高亮
【发布时间】:2017-05-27 17:27:54
【问题描述】:

某些单词(functionifelsereturn 等)会自动格式化为斜体是 VS Code。如何禁用此行为?

【问题讨论】:

    标签: javascript syntax visual-studio-code


    【解决方案1】:

    您可以使用以下用户配置强制 VS 为您的主题禁用所有斜体:

    "editor.tokenColorCustomizations": {
      "textMateRules": [
        {
          "scope": [
            "comment",
            "comment.block",
            "comment.block.documentation",
            "comment.line",
            "constant",
            "constant.character",
            "constant.character.escape",
            "constant.numeric",
            "constant.numeric.integer",
            "constant.numeric.float",
            "constant.numeric.hex",
            "constant.numeric.octal",
            "constant.other",
            "constant.regexp",
            "constant.rgb-value",
            "emphasis",
            "entity",
            "entity.name",
            "entity.name.class",
            "entity.name.function",
            "entity.name.method",
            "entity.name.section",
            "entity.name.selector",
            "entity.name.tag",
            "entity.name.type",
            "entity.other",
            "entity.other.attribute-name",
            "entity.other.inherited-class",
            "invalid",
            "invalid.deprecated",
            "invalid.illegal",
            "keyword",
            "keyword.control",
            "keyword.operator",
            "keyword.operator.new",
            "keyword.operator.assignment",
            "keyword.operator.arithmetic",
            "keyword.operator.logical",
            "keyword.other",
            "markup",
            "markup.bold",
            "markup.changed",
            "markup.deleted",
            "markup.heading",
            "markup.inline.raw",
            "markup.inserted",
            "markup.italic",
            "markup.list",
            "markup.list.numbered",
            "markup.list.unnumbered",
            "markup.other",
            "markup.quote",
            "markup.raw",
            "markup.underline",
            "markup.underline.link",
            "meta",
            "meta.block",
            "meta.cast",
            "meta.class",
            "meta.function",
            "meta.function-call",
            "meta.preprocessor",
            "meta.return-type",
            "meta.selector",
            "meta.tag",
            "meta.type.annotation",
            "meta.type",
            "punctuation.definition.string.begin",
            "punctuation.definition.string.end",
            "punctuation.separator",
            "punctuation.separator.continuation",
            "punctuation.terminator",
            "storage",
            "storage.modifier",
            "storage.type",
            "string",
            "string.interpolated",
            "string.other",
            "string.quoted",
            "string.quoted.double",
            "string.quoted.other",
            "string.quoted.single",
            "string.quoted.triple",
            "string.regexp",
            "string.unquoted",
            "strong",
            "support",
            "support.class",
            "support.constant",
            "support.function",
            "support.other",
            "support.type",
            "support.type.property-name",
            "support.variable",
            "variable",
            "variable.language",
            "variable.name",
            "variable.other",
            "variable.other.readwrite",
            "variable.parameter"
          ],
          "settings": {
            "fontStyle": ""
          }
        }
      ]
    }

    原文出处: https://github.com/microsoft/vscode/issues/32579#issuecomment-341502559

    【讨论】:

    • 如果您觉得有用,请考虑接受答案,谢谢:)
    • 如果您从某处复制粘贴某些内容,请链接到它的引用。完全相同的代码是here
    • 可悲的是,它也会擦除粗体。我只选择了与评论相关的范围。
    【解决方案2】:

    原来我使用了错误的主题!新的主题改变了它,它工作得很好。

    【讨论】:

      【解决方案3】:

      您可以将这些配置添加到您的 settings.json 文件中:

      ...       
      "editor.tokenColorCustomizations": { 
                  "[Material Monokai High Contrast]": {
                      "textMateRules": [
                          {
                              "scope": "entity.name.function",
                              "settings": {
                                  "foreground": "#9DFF00",
                                  "fontStyle": ""
                              }
                          }
                      ]
                  },
              }
      

      [Material Monokai High Contrast] : 你要修改的主题。

      您也可以尝试使用 ctrl + space 来自动完成并帮助您。

      【讨论】:

        猜你喜欢
        • 2022-01-14
        • 2017-02-10
        • 1970-01-01
        • 2016-05-31
        • 2022-09-30
        • 2020-02-12
        • 1970-01-01
        • 2021-12-22
        • 1970-01-01
        相关资源
        最近更新 更多