Visual studio code 代码背景颜色取决于使用的语言

Visual studio code 代码背景颜色取决于使用的语言,visual-studio-code,vscode-settings,Visual Studio Code,Vscode Settings,是否可以更改文本编辑器背景取决于语言? 贝特文代码 <?php ... ?> 及 。。。 使用其他背景色使其更可见。我认为您必须使用类似的颜色 然后在您的设置中: "highlight.regexes": { "(<script>\\s*)(\\r\\n)+((.*\\r\\n)*?)(\\s*<\\/script>)" : [ {}, {}, { "backgroundColor": "#0

是否可以更改文本编辑器背景取决于语言? 贝特文代码

<?php ... ?>

。。。

使用其他背景色使其更可见。

我认为您必须使用类似的颜色

然后在您的设置中:

"highlight.regexes": {

   "(<script>\\s*)(\\r\\n)+((.*\\r\\n)*?)(\\s*<\\/script>)" : [
      {},
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ],

    "(<script>\\s*)(.*?)(\\s*<\\/script>)" : [
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ],

    "(<\\?php\\s*)(.*?)(\\s*\\?>)" : [
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ],

    "(<\\?php)(\\r\\n)+((.*\\r\\n)*?)(\\s*\\?>)" : [
      {},
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ]
  }
}
“highlight.regex”:{
“(\\s*)(\\r\\n)+(.*\\r\\n)*?)(\\s*)”:[
{},
{},
{
“背景色”:“009”,
“颜色”:“fff”,
},
{}
],
“(\\s*)(.*)(\\s*)”:[
{},
{
“背景色”:“009”,
“颜色”:“fff”,
},
{}
],
"()" : [
{},
{
“背景色”:“009”,
“颜色”:“fff”,
},
{}
],
"()" : [
{},
{},
{
“背景色”:“009”,
“颜色”:“fff”,
},
{}
]
}
}
此编辑版本应适用于多行示例


当您在设置中编辑完vscode后,您必须重新加载vscode。

谢谢您的建议!它确实有效,但问题是只检测一行代码。如果我有新行字符,标签样式将消失@这应该很容易修复。稍后我将尝试访问它。我编辑了答案以支持多行版本。让我知道它是否适合你。并且重新加载。仍然任何enter键都会破坏样式:我想我用\\r\\n键解决了多行问题
"highlight.regexes": {

   "(<script>\\s*)(\\r\\n)+((.*\\r\\n)*?)(\\s*<\\/script>)" : [
      {},
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ],

    "(<script>\\s*)(.*?)(\\s*<\\/script>)" : [
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ],

    "(<\\?php\\s*)(.*?)(\\s*\\?>)" : [
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ],

    "(<\\?php)(\\r\\n)+((.*\\r\\n)*?)(\\s*\\?>)" : [
      {},
      {},
      {
        "backgroundColor": "#009",
        "color": "#fff",
      },
      {}
    ]
  }
}