在 vs-code 中的 JSON 中,如何为数组中的字符串提供与对象中的字符串不同的颜色?
in JSON in vs-code, how can I give strings in arrays a different color than strings in objects?
我希望能够一目了然地看到数组在哪里以及对象在哪里,因此我想为数组中的字符串提供与对象中的字符串不同的突出显示。这可能吗?如果可以,我该怎么做?
例子
{
"A": "a1", //A=red, a1=red
"B": [ //B=red
"C": "c1", //C=blue, c1=red
"D": { //D=blue
"E": "e1" //E=red, e1=red
}
]
}
使用 current JSON grammar 这是不可能的,因为尽管键和其他字符串之间存在差异,但对象中的字符串和数组中的字符串之间存在 none。
如果存在这种区别,可以使用 settings.json 中的 editor.tokenColorCustomizations
条目更改颜色。见 Visual Studio Code Themes
我希望能够一目了然地看到数组在哪里以及对象在哪里,因此我想为数组中的字符串提供与对象中的字符串不同的突出显示。这可能吗?如果可以,我该怎么做?
例子
{
"A": "a1", //A=red, a1=red
"B": [ //B=red
"C": "c1", //C=blue, c1=red
"D": { //D=blue
"E": "e1" //E=red, e1=red
}
]
}
使用 current JSON grammar 这是不可能的,因为尽管键和其他字符串之间存在差异,但对象中的字符串和数组中的字符串之间存在 none。
如果存在这种区别,可以使用 settings.json 中的 editor.tokenColorCustomizations
条目更改颜色。见 Visual Studio Code Themes